arcade-mcp/libs/arcade-mcp-server/arcade_mcp_server
Eric Gustin 05682d54fe
Don't return structuredContent when error (#817)
We recently added outputSchema support for our MCP tools (not yet for
worker routes yet). Today, we always return structuredContent. On tool
execution errors we return structuredContent: {"error": "..."} with
isError: True, even when that shape does not match the tool’s declared
outputSchema. Since the MCP spec says clients SHOULD validate
structuredContent against outputSchema, some clients reject these
responses.

Since structuredContent is optional, we’re going to omit it when
isError: true.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the shape of tool error responses across the MCP server, which
may break clients or tools that previously relied on
`structuredContent["error"]` for failures. Behavior is more
spec-compliant but touches core request/response paths and test
expectations.
> 
> **Overview**
> Prevents MCP tool error responses from violating a tool’s declared
`outputSchema` by **always setting `structuredContent=None` when
`isError=True`** (server execution errors, unknown tools, middleware
exceptions, and `Context.tools.call_raw` JSON-RPC errors).
> 
> Updates requirement-failure error formatting to put the human-friendly
message in `content[0]` and (when present) serialize extra
machine-readable fields (e.g. `authorization_url`, `llm_instructions`)
into an additional `content` item. Examples and integration/unit tests
are updated to read errors from `content[0].text`, and
`arcade-mcp-server` is bumped to `1.19.2`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4213bdd4aa44362de85c30f5f31c576243c132d5. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-04-10 15:27:07 -07:00
..
auth [TOO-326] Windows papercuts (#768) 2026-02-25 13:18:16 -03:00
fastapi Front-Door Auth (#696) 2025-12-11 12:51:20 -08:00
managers Add full support for MCP Resources (#803) 2026-03-27 15:27:57 -07:00
middleware Don't return structuredContent when error (#817) 2026-04-10 15:27:07 -07:00
resource_server Support Ed25519 Algorithm (#742) 2026-01-16 15:55:05 -08:00
transports [TOO-326] Windows papercuts (#768) 2026-02-25 13:18:16 -03:00
usage Front-Door Auth (#696) 2025-12-11 12:51:20 -08:00
__init__.py Add full support for MCP Resources (#803) 2026-03-27 15:27:57 -07:00
__main__.py Fix runtime warning (#771) 2026-02-25 09:55:37 -08:00
_validation.py [TOO-518] Enforce semver for MCPApp Versioning (#793) 2026-03-16 16:06:25 -07:00
context.py Don't return structuredContent when error (#817) 2026-04-10 15:27:07 -07:00
convert.py fix: TypedDict total=False output breaks validation (#816) 2026-04-09 17:47:57 -07:00
exceptions.py Re-import arcade_core errors into arcade_mcp_server (#620) 2025-10-13 17:48:54 -07:00
lifespan.py MCP Local (#563) 2025-09-25 15:28:15 -07:00
logging_utils.py Fix runtime warning (#771) 2026-02-25 09:55:37 -08:00
mcp_app.py Add full support for MCP Resources (#803) 2026-03-27 15:27:57 -07:00
metadata.py Add Tool Metadata (#766) 2026-02-17 14:31:45 -08:00
py.typed Inform type checkers that arcade_mcp_server has inline type annotations (#720) 2025-12-09 15:35:15 -08:00
server.py Don't return structuredContent when error (#817) 2026-04-10 15:27:07 -07:00
session.py Front-Door Auth (#696) 2025-12-11 12:51:20 -08:00
settings.py [TOO-518] Enforce semver for MCPApp Versioning (#793) 2026-03-16 16:06:25 -07:00
stdio_runner.py Add full support for MCP Resources (#803) 2026-03-27 15:27:57 -07:00
types.py Front-Door Auth (#696) 2025-12-11 12:51:20 -08:00
worker.py Add full support for MCP Resources (#803) 2026-03-27 15:27:57 -07:00