Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/late/mcp/apps/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
19 changes: 10 additions & 9 deletions tests/test_mcp_tool_sdk_signatures.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]]]:
Expand Down Expand Up @@ -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()), "<module>")
for module in TOOL_MODULES:
visit(ast.parse(module.read_text()), "<module>")
return calls


Expand Down
Loading