Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **The MCP server runs on FastMCP 4 and MCP SDK 2.** The `mcp` extra now needs Python 3.11 or later, as FastMCP 4 does: on Python 3.10 it installs without FastMCP and the MCP server cannot run. The SDK itself still supports 3.10. Behavior FastMCP 4 changed is kept: guessed tool names sent through `call_tool` get the closest tools again, a result holding half an emoji is repaired instead of failing the call, and a pydantic error inside a tool logs where and why it failed, never the response values. The protected-resource metadata override is gone, since MCP SDK 2 renders the issuer without a trailing slash.

### Fixed
- **A guessed tool name sent through `call_tool` opened a Sentry issue.** FastMCP 4's `call_tool` checks the name itself and wraps its `NotFoundError` in a `ToolError`, and FastMCP 4's `NotFoundError` is not a `FastMCPError`, so the failure counted as a bug: Sentry ZERNIO-MCP-S (8 Cursor guesses) and a traceback in the server log. It is an expected failure again; the agent still gets the closest tool names.
- **A rate-limited MCP tool call did not say how long to wait, so agents retried into the limit.** 429s were 84% of tool errors (433,000 in the week to Nov 18). The SDK replaced the API's 429 body with "Rate limit exceeded" and dropped `Retry-After`, and for a platform quota (Meta, Google, Reddit) it quoted the Zernio API's own reset time, which says nothing about when the platform accepts requests again. `LateRateLimitError` now keeps the API's message, `code`, `platform` and `details`, and adds `retry_after` (seconds, from `Retry-After` as seconds or a date). The MCP server and the ChatGPT server tell the agent to wait that long, or not to retry an exhausted platform quota, and `mcp_tool_call` logs `retry_after_s`.
- **`pip install zernio-sdk` without extras could not import the models.** `EmailStr` fields need `email-validator`, which only arrived through FastMCP. The SDK now depends on `pydantic[email]`.

Expand Down
5 changes: 3 additions & 2 deletions src/late/mcp/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def quiet_routine_logs() -> None:
def is_expected_failure(exc: Exception) -> bool:
if isinstance(exc, ToolError) and exc.__cause__ is not None:
# A generated tool re-wraps what it raised itself, e.g. the refusal
# of a file too large to return.
return isinstance(exc.__cause__, (LateError, FastMCPError))
# of a file too large to return, and FastMCP 4's call_tool re-wraps
# the NotFoundError of a guessed name (not a FastMCPError).
return isinstance(exc.__cause__, (LateError, FastMCPError, NotFoundError))
return isinstance(exc, (FastMCPError, NotFoundError, LateError))
16 changes: 16 additions & 0 deletions tests/test_mcp_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,22 @@ async def test_a_tool_behind_call_tool_is_one_sentry_transaction(sentry_events)
assert transaction["tags"]["mcp.via"] == "call_tool"


async def test_a_guessed_name_through_call_tool_opens_no_sentry_issue(
sentry_events, quieted_fastmcp_logs
) -> None:
# FastMCP 4's call_tool checks the name itself and re-wraps its NotFoundError
# in a ToolError: 8 Cursor guesses became Sentry issue ZERNIO-MCP-S.
async with Client(_proxied_server()) as client:
await client.call_tool(
"call_tool",
{"name": "lead_gen_list_forms", "arguments": {}},
raise_on_error=False,
)

assert sentry_events.payloads("event") == []
assert quieted_fastmcp_logs.records == []


async def test_a_direct_call_is_tagged_direct_with_its_caller(
sentry_events, monkeypatch
) -> None:
Expand Down
Loading