Skip to content

fix: plan_file_info returns empty for report artifact on HTTP server - #166

Merged
neoneye merged 1 commit into
mainfrom
mcp-file-info-report-empty
Mar 7, 2026
Merged

fix: plan_file_info returns empty for report artifact on HTTP server#166
neoneye merged 1 commit into
mainfrom
mcp-file-info-report-empty

Conversation

@neoneye

Copy link
Copy Markdown
Member

Summary

  • Root cause: FastMCP derives outputSchema from Annotated[CallToolResult, OutputModel] return type annotations, producing a schema that only covers the success shape. Tools like plan_file_info and plan_status have multiple response shapes (oneOf: success, not-ready, error). The derived schema misses the other shapes, causing MCP clients to see non-conforming responses as empty.
  • Fix: Remove output model annotations from all 8 tool functions, inject canonical oneOf schemas from TOOL_DEFINITIONS into FastMCP tools after registration.
  • Defense: Add JSON-RPC guard in strip_redundant_content to prevent accidental stripping of MCP protocol envelopes.
  • Tests: 16 new tests covering all response shapes, schema structure, return-type regression, and content stripping edge cases (51 → 67 tests across the 3 files).
  • Docs: New AGENTS.md section documenting the injection pattern, rules, and potential issues with private FastMCP internals.
  • Cleanup: Rename legacy "task-id""plan-id" in test fixtures.

Test plan

  • test_http_utils.py — 10 tests: JSON-RPC guard (error, notification, content-only), non-JSON-RPC stripping, value preservation
  • test_plan_file_info_tool.py — 15 tests: every response shape (pending, processing, completed, failed, not-found) for both report and zip, structuredContent presence, content/structuredContent consistency
  • test_tool_surface_consistency.py — 45 tests: FastMCP schema matches TOOL_DEFINITIONS, oneOf variant counts, no Annotated return types, schema not derived from flat Pydantic model
SQLALCHEMY_DATABASE_URI=sqlite:// PLANEXE_MCP_REQUIRE_AUTH=false \
python -m pytest mcp_cloud/tests/test_http_utils.py \
mcp_cloud/tests/test_plan_file_info_tool.py \
mcp_cloud/tests/test_tool_surface_consistency.py -v

🤖 Generated with Claude Code

@neoneye
neoneyeforce-pushed the mcp-file-info-report-empty branch 2 times, most recently from 110e188 to 69e58d7CompareMarch 7, 2026 13:48
Root cause: FastMCP derives outputSchema from Annotated[CallToolResult,
OutputModel] return type annotations, producing a schema that only
covers the success shape. Tools with multiple response shapes (oneOf:
success, not-ready, error) had non-conforming responses seen as empty
by MCP clients.
Fix: Remove output model annotations from all 8 tool functions. Inject
canonical schemas from TOOL_DEFINITIONS as instance attributes on
FastMCP Tool objects (shadowing the cached_property) so list_tools()
advertises the correct schema while convert_result() skips validation.
oneOf schemas (plan_status, plan_file_info) are not advertised because
MCP clients require outputSchema to have "type": "object" at top level.
Also: add JSON-RPC guard in strip_redundant_content, rename legacy
"task-id" to "plan-id" in test fixtures, document the injection pattern
and constraints in AGENTS.md.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@neoneye
neoneyeforce-pushed the mcp-file-info-report-empty branch from 69e58d7 to d5423f8CompareMarch 7, 2026 13:57
@neoneye
neoneye merged commit 1bc6e19 into mainMar 7, 2026
3 checks passed
@neoneye
neoneye deleted the mcp-file-info-report-empty branch March 7, 2026 14:56
huangyingting pushed a commit to repomesh/PlanExe that referenced this pull request Jun 26, 2026
Resolves Dependabot security alerts in worker_plan/pyproject.toml by bumping to the first stable patched release of each package:
- aiohttp 3.13.5 -> 3.14.1 (alerts PlanExeOrg#152,PlanExeOrg#153,PlanExeOrg#156-PlanExeOrg#164)
- tornado 6.5.4 -> 6.5.7 (alerts PlanExeOrg#113,PlanExeOrg#114,PlanExeOrg#136,PlanExeOrg#155,PlanExeOrg#165,PlanExeOrg#166,PlanExeOrg#171)
- python-multipart 0.0.22 -> 0.0.32 (alerts PlanExeOrg#142,PlanExeOrg#149,PlanExeOrg#167-PlanExeOrg#170)
- urllib3 2.6.3 -> 2.7.0 (alerts PlanExeOrg#150,PlanExeOrg#151)
- marshmallow 3.24.2 -> 3.26.2 (alert PlanExeOrg#81), staying on 3.x to avoid the breaking 4.x major
transformers alert PlanExeOrg#137 is excluded: its only fix is the 5.x major line and the vulnerable Trainer class is never imported by PlanExe (handled separately).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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

@neoneye