From eda8b3752dfe0c825c2cf1a883be8aa3ef9ac814 Mon Sep 17 00:00:00 2001 From: elean-latedev Date: Tue, 24 Nov 2026 20:43:05 +0000 Subject: [PATCH] fix(mcp): show_conversation passes account_id by keyword The 1.4.1911 regen made get_inbox_conversation_messages take account_id as keyword-only, so the MCP App view raised TypeError on every call. The SDK signature test now also covers apps/tools.py. Co-Authored-By: Claude Opus 5.5 --- src/late/mcp/apps/tools.py | 2 +- tests/test_mcp_tool_sdk_signatures.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/late/mcp/apps/tools.py b/src/late/mcp/apps/tools.py index bc3c8aac0..22f3f54bb 100644 --- a/src/late/mcp/apps/tools.py +++ b/src/late/mcp/apps/tools.py @@ -428,7 +428,7 @@ def show_conversation(conversation_id: str, account_id: str) -> ToolResult: client = _server()._get_client() result = _api( lambda: client.messages.get_inbox_conversation_messages( - conversation_id, account_id, limit=30, sort_order="desc" + conversation_id, account_id=account_id, limit=30, sort_order="desc" ) ) keep = ("id", "message", "senderName", "direction", "createdAt", "platform", "isDeleted") diff --git a/tests/test_mcp_tool_sdk_signatures.py b/tests/test_mcp_tool_sdk_signatures.py index 1bb4b889d..715c31d37 100644 --- a/tests/test_mcp_tool_sdk_signatures.py +++ b/tests/test_mcp_tool_sdk_signatures.py @@ -1,10 +1,11 @@ -"""Every SDK call in the generated MCP tools must bind to the real client method. +"""Every SDK call in the MCP tools must bind to the real client method. generated_tools.py and the SDK resources are regenerated together, but the -hand-written resources can shadow or hide generated methods. When they drift, -the MCP tool raises TypeError/AttributeError on every call (e.g. -accounts_get_follower_stats after limit/cursor were added). This check runs -in CI on regen PRs, so drift fails before deploy. +hand-written resources can shadow or hide generated methods, and the MCP App +views in apps/tools.py are never regenerated. When they drift, the MCP tool +raises TypeError/AttributeError on every call (e.g. accounts_get_follower_stats +after limit/cursor were added). This check runs in CI on regen PRs, so drift +fails before deploy. """ from __future__ import annotations @@ -17,9 +18,8 @@ from late import Late -GENERATED_TOOLS = ( - Path(__file__).resolve().parents[1] / "src" / "late" / "mcp" / "generated_tools.py" -) +MCP_DIR = Path(__file__).resolve().parents[1] / "src" / "late" / "mcp" +TOOL_MODULES = (MCP_DIR / "generated_tools.py", MCP_DIR / "apps" / "tools.py") def _sdk_calls() -> list[tuple[str, str, str, int, list[str]]]: @@ -49,7 +49,8 @@ def visit(node: ast.AST, func_name: str) -> None: for child in ast.iter_child_nodes(node): visit(child, func_name) - visit(ast.parse(GENERATED_TOOLS.read_text()), "") + for module in TOOL_MODULES: + visit(ast.parse(module.read_text()), "") return calls