Skip to content

fix(tasks): raise on failure so isError=true on the MCP wire#36

Open
sanjibani wants to merge 1 commit into
mjunaidca:mainfrom
sanjibani:fix/iserror-compliance
Open

fix(tasks): raise on failure so isError=true on the MCP wire#36
sanjibani wants to merge 1 commit into
mjunaidca:mainfrom
sanjibani:fix/iserror-compliance

Conversation

@sanjibani

Copy link
Copy Markdown

Summary

9 except APIError as e: return _format_error(e) and 9 except Exception as e: return json.dumps({"error": True, ...}) sites in apps/mcp-server/src/taskflow_mcp/tools/tasks.py all returned JSON-encoded error strings. FastMCP wraps those as success content with isError=false, so MCP clients treat the failure as data and the LLM often proceeds as if the call had succeeded.

This is the same isError-compliance gap flagged in the recent MCP security audit (Dayna Blackwell, Tool Poisoning, Rug Pulls, and Prompt Injections — oh my!).

Changes

Each return is replaced with bare raise so the original exception propagates and FastMCP sets isError=true on the wire while preserving the formatted message in content for the LLM.

Tests

apps/mcp-server/tests/test_iserror_compliance.py asserts that a failing create_task call surfaces as ToolError (isError=true on the wire).

Reference: https://composio.dev/blog/mcp-security-vulnerabilities

9 `except APIError as e: return _format_error(e)` and 9
`except Exception as e: return json.dumps({"error": True, ...})`
sites in apps/mcp-server/src/taskflow_mcp/tools/tasks.py all returned
JSON-encoded error strings. FastMCP wraps those as success content
with isError=false, so MCP clients treat the failure as data and the
LLM often proceeds as if the call had succeeded.

This is the same isError-compliance gap flagged in the recent MCP
security audit (Dayna Blackwell, 'Tool Poisoning, Rug Pulls, and
Prompt Injections — oh my!').

Each return is replaced with bare `raise` so the original exception
propagates and FastMCP sets isError=true on the wire while preserving
the formatted message in content for the LLM.

Regression test: apps/mcp-server/tests/test_iserror_compliance.py
asserts that a failing create_task call surfaces as ToolError
(isError=true on the wire).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant