Skip to content

feat(mcp): forgive get_symbol(id=) and ground a hedged get_answer on the served body#783

Open
RaghavChamadiya wants to merge 2 commits into
mainfrom
feat/mcp-symbol-alias-answer-grounding
Open

feat(mcp): forgive get_symbol(id=) and ground a hedged get_answer on the served body#783
RaghavChamadiya wants to merge 2 commits into
mainfrom
feat/mcp-symbol-alias-answer-grounding

Conversation

@RaghavChamadiya

Copy link
Copy Markdown
Member

Two small MCP fixes for friction hit while using the tools for normal exploration. Both are additive and behavior-preserving outside the exact cases they target.

get_symbol accepts id= as an alias for symbol_id=

The tool table documents this tool as get_symbol(id), so id= is the natural call, but the parameter was symbol_id and the mismatched call returned a hard pydantic Field required error. That is the kind of one-off error that trains a caller to stop using the tool.

id is now accepted as an alias. symbol_id still wins when both are given, and passing neither returns the existing shaped "required" response instead of raising.

A hedged get_answer stays at medium when it already serves the named body

When synthesis hedges but the exact symbol the question named is inlined in symbol_bodies as its full live body, the answer's ground truth is already in the payload. Reporting confidence: "low" with a "read the fallback targets" hint contradicts what was returned and pushes the caller to re-read a file it does not need.

Such a response now holds at confidence: "medium" with grounding: "symbol_body" and a note that points at the served body. The bump is gated to the exact question-named symbol only (tier-0 anchor); a hedge with no such body still reports low as before.

Tests

  • test_symbol_range_and_recovery.py: id= alias resolves, symbol_id wins over id, neither returns the shaped error.
  • test_answer_calibration.py: hedge + served named body holds medium + grounding, with a negative control that a hedge without the body stays low.
  • Full tests/unit/server/mcp suite green (422).

@repowise-bot

repowise-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

✅ Health: 7.6 (unchanged)

📋 At a glance
1 file changed health · 4 hotspots touched · 5 new findings introduced · 5 co-change pairs left out · 2 files with recent fix history · 1 dead-code finding.

Files & modules (2)
  • packages (2 files)
    • .../tool_answer/answer.py
    • .../mcp_server/tool_symbol.py
  • tests (2 files)
    • .../mcp/test_symbol_range_and_recovery.py
    • .../mcp/test_answer_calibration.py

⚠️ Change risk: moderate (riskier than 39% of this repo's commits · raw 8.4/10)
This change's risk is driven by:

  • more lines added than baseline
  • more scattered than baseline

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

File Score Δ Why
.../mcp/test_symbol_range_and_recovery.py 10.0 → 9.3 ▼ -0.7 🔻 introduced duplicated assertion block

💡 .../mcp/test_symbol_range_and_recovery.py: De-duplicate this assertion block. The same checks are copy-pasted across tests, so a behaviour change must be edited in several places and usually isn't. Extract the shared assertions into a helper or parametrize the cases over the varying inputs.

🔎 More signals (3)

🔥 Hotspots touched (4)

  • .../mcp/test_symbol_range_and_recovery.py — 2 commits/90d, 2 dependents · primary owner: Swati Ahuja (63%)
  • .../tool_answer/answer.py — 13 commits/90d, 2 dependents · primary owner: Swati Ahuja (54%)
  • .../mcp/test_answer_calibration.py — 4 commits/90d, 3 dependents · primary owner: Raghav Chamadiya (64%)
1 more
  • .../mcp_server/tool_symbol.py — 11 commits/90d, 7 dependents · primary owner: Swati Ahuja (53%)

🔗 Hidden coupling (2 files)

  • .../mcp_server/tool_symbol.py co-changes with these files (not in this PR):
    • .../mcp_server/tool_search.py (7× — 🟢 routine)
    • .../mcp_server/tool_overview.py (6× — 🟢 routine)
    • .../mcp_server/tool_why.py (5× — 🟢 routine)
  • .../tool_answer/answer.py co-changes with these files (not in this PR):
    • .../tool_answer/config.py (6× — 🟢 routine)
    • .../tool_answer/symbols.py (5× — 🟢 routine)

💀 Dead code (1 finding)

  • 💀 .../tool_answer/answer.py _json_default (confidence 0.65)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-11 14:19 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

The tool table documents this tool as get_symbol(id), so id= is the
natural call, but the parameter is symbol_id and the mismatched call hit
a hard pydantic "field required" error. Accept id as an alias (symbol_id
wins when both are given); passing neither still returns the shaped
"required" error rather than raising.
…eady serves

When synthesis hedges but the exact symbol the question named is inlined
in symbol_bodies as its full live body, the answer's ground truth is
already in hand. Labeling that response "low" with a "read the fallback
targets" hint contradicts the payload and pushes the caller to re-read a
file it does not need. Hold such a response at medium with
grounding="symbol_body" and a note that points at the served body.
@swati510 swati510 force-pushed the feat/mcp-symbol-alias-answer-grounding branch from 1db0178 to f6e0870 Compare July 11, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant