Repository navigation
MCP: fix show_conversation TypeError after account_id became keyword-only - #131
Merged
Merged
Conversation
…only
The 2026-11-20 spec regen made accountId optional on
GET /v1/inbox/conversations/{id}/messages, so the generator moved
account_id behind `*` in get_inbox_conversation_messages. show_conversation
still passed it positionally and raised TypeError on every call, before
any request went out.
Pass account_id (and every other non-path argument in the app tools) by
keyword, so a required-to-optional flip in the spec cannot break these
call sites again. Add a test that binds every hand-written client.<res>.<method>
call in late/mcp against the current SDK signatures, so a regen that breaks
one fails CI, plus an end-to-end show_conversation test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… tests show_post_preview passed the platforms body field positionally, the same pattern that broke show_conversation: if the spec ever makes it optional, the regen moves it behind `*` and the tool raises TypeError. The call-site test now finds SDK calls on any receiver and, for generated resources, fails when anything other than a URL path parameter is passed positionally, so the risk is caught before a regen turns it into a crash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The hosted MCP tool
show_conversationfails on every call:The error is raised inside the MCP process before any request goes out, which is why no API logs show it.
messages_get_inbox_conversation_messagesandshow_inboxstill work with the same ids.Root cause
show_conversation, which callsclient.messages.get_inbox_conversation_messages(conversation_id, account_id, ...)withaccount_idpassed positionally.accountIdoptional onGET /v1/inbox/conversations/{id}/messages. The generator puts optional params after*, soaccount_idbecame keyword-only and the hand-written call broke. The generated tool (generated_tools.py) already passed it by keyword and kept working.Why nothing caught it
late.mcp.*is inignore_errors, and the app tools get their client through_server() -> Any. mypy saw nothing.generate.yml) does runpytestbefore it commits, but nothing exercisedshow_conversation, which only registers whenZERNIO_MCP_APPSis set.Fix
show_conversationpassesaccount_id=account_id.show_post_preview'svalidate_post(platforms=...), which had the same latent bug:platformsis a body field and was passed by position. Keyword arguments still work when the spec makes a param optional.Audit of other call sites
generated_tools.py: all 1,390 SDK calls already pass every non-path argument by keyword. None are at risk.server.py: calls the hand-written resources inlate/resources/*.py, which regen doesn't touch. Not at risk.apps/tools.py:show_conversation(broken) andvalidate_post(latent). Both fixed here.Tests (
tests/test_mcp_sdk_call_sites.py)<x>.<resource>.<method>(...)call underlate/mcpmust bind to the current SDK signature.show_conversationcall (respx) checks thataccountIdis sent.The regen workflow runs pytest before it commits, so a regen that would break a call site now stops there instead of shipping.
Verification
validate_postcall.develop,show_conversationreturns the TypeError; on this branch it returns the conversation.🤖 Generated with Claude Code