Skip to content

fix(mcp_server): handle missing team_id argument safely#285

Merged
mvillmow merged 2 commits into
mainfrom
283-auto-impl
Jun 29, 2026
Merged

fix(mcp_server): handle missing team_id argument safely#285
mvillmow merged 2 commits into
mainfrom
283-auto-impl

Conversation

@mvillmow

Copy link
Copy Markdown
Contributor

Summary

Add defensive guard for missing team_id argument in Dispatcher.call_tool to prevent unhandled KeyError from crashing the MCP server process. Raise a descriptive ValueError instead so the server remains responsive across malformed requests.

Changes

  • Added null-check for team_id in mcp_server.py:82 to catch missing argument before string coercion
  • Raise descriptive ValueError with actionable error message when team_id is omitted
  • Added comprehensive test coverage for missing team_id scenario in test_mcp_server.py

Testing

  • Test that omitting team_id argument returns proper error response instead of crashing
  • Verify MCP server process remains alive after handling malformed request
  • Confirm error message is descriptive and identifies the root cause

Closes

Closes #283

Generated by Claude Code via ProjectHephaestus automation.

@mvillmow mvillmow left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#283 missing-team_id guard is correct, complete, idiomatic, and tested. Minor: commit message describes raise as 'return TextContent'. Scope note: PR bundles full #173 server.

Comment thread src/telemachy/mcp_server.py
Dispatcher.call_tool raised an unhandled KeyError when an MCP client
omitted team_id, crashing the stdio server. Raise a descriptive
ValueError (MissingArgumentError) instead — mirroring UnknownToolError —
which the SDK's call_tool wrapper converts into a structured isError
result, so the server stays alive across bad requests.

Closes #283

Implemented-By: claude-sonnet-4-6
Co-Authored-By: Claude Code <noreply@anthropic.com>
Signed-off-by: mvillmow <4211002+mvillmow@users.noreply.github.com>
@mvillmow mvillmow enabled auto-merge (squash) June 28, 2026 18:45
GHSA-4xgf-cpjx-pc3j)

Signed-off-by: Micah Villmow <4211002+mvillmow@users.noreply.github.com>
@mvillmow mvillmow merged commit 2b0ab9e into main Jun 29, 2026
15 checks passed
@mvillmow mvillmow deleted the 283-auto-impl branch June 29, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up from #173: 1 item(s) (safety)

1 participant