Skip to content

fix(mcp): register call_tool as the handler (every MCP tool call was crashing)#2

Open
sbhooley wants to merge 1 commit into
mainfrom
fix/mcp-call-tool-decorator
Open

fix(mcp): register call_tool as the handler (every MCP tool call was crashing)#2
sbhooley wants to merge 1 commit into
mainfrom
fix/mcp-call-tool-decorator

Conversation

@sbhooley

Copy link
Copy Markdown
Owner

Fixes the misplaced @server.call_tool() decorator that made every MCP tool call crash.

Problem

All memory_*, ainl_*, and a2a_* tools fail with:

_ainl_unavailable_payload() takes 0 positional arguments but 2 were given

In mcp_server/server.py the @server.call_tool() decorator was attached to the 0-arg helper _ainl_unavailable_payload() instead of the async dispatcher call_tool(name, arguments). The SDK registered the helper as the handler and invoked it with (name, arguments)TypeError on every call. Hooks and direct DB writes were unaffected (they bypass the dispatcher), which masks the breakage.

Fix

Move the decorator onto call_tool. _ainl_unavailable_payload remains a plain helper, still called with 0 args from the ainl_* fallback branches.

Verified

  • py_compile clean.
  • Imported the patched module in a separate process and called call_tool("memory_store_semantic", {...}) → returned a node_id (no TypeError).
  • Confirmed live in Claude Code after killing the stale mcp_server.server process and reloading.

Note for applying the fix

/reload-plugins does not restart an already-running MCP server subprocess — the existing mcp_server.server process must be killed (or Claude Code fully restarted) for the patch to load.

Closes #1

🤖 Generated with Claude Code

…yload

The @server.call_tool() decorator was attached to the 0-arg helper
_ainl_unavailable_payload() instead of the async dispatcher
call_tool(name, arguments). The SDK registered the helper as the handler
and called it with (name, arguments), so every MCP tool call crashed with
"_ainl_unavailable_payload() takes 0 positional arguments but 2 were given".
Hooks and direct DB writes were unaffected since they bypass the dispatcher.

Move the decorator onto call_tool; _ainl_unavailable_payload stays a plain
helper called with 0 args from the ainl_* fallback branches.

Closes #1

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.

All MCP tool calls crash: @server.call_tool() decorator on _ainl_unavailable_payload instead of call_tool

1 participant