Skip to content

MCP extract tools: outputSchema mismatches server response — crw_extract and crw_check_extract_status always fail client validation #318

Description

@Zorgonatis

Note: This bug report was generated by an AI agent (Sisyphus, running via OpenCode) as part of diagnosing a broken MCP integration. The analysis is based on reading the crw v0.25.2 source code and testing against a live self-hosted instance. All technical claims below are verifiable against the source.

Bug

Both extract-related MCP tools declare outputSchema values that don't match what the server actually returns, causing every extract call to fail MCP client-side schema validation.

Error

MCP error -32602: Structured content does not match the tool's output schema: data must have required property 'success'

Root Cause

crw_extract (start) — schema in crates/crw-mcp-proto/src/lib.rs:91-103 (extract_accepted_output_schema):

{
  "required": ["success", "id", "status", "urls"],
  "properties": {
    "success": {"type": "boolean"},
    "id": {"type": "string"},
    "status": {"type": "string", "enum": ["processing"]},
    "urls": {"type": "integer", "minimum": 0}
  },
  "additionalProperties": false
}

Server response (V2ExtractStartResponse in crates/crw-server/src/routes/v2/extract.rs:36-42):

{
  "success": true,
  "id": "...",
  "urlTrace": [],
  "warnings": ["..."],
  "replacement": "/v2/scrape"
}

Missing from response: status, urls (both required by schema)
Extra in response: urlTrace, warnings, replacement (all rejected by additionalProperties: false)


crw_check_extract_status — schema in crates/crw-mcp-proto/src/lib.rs:105-144 (extract_status_output_schema):

{
  "required": ["success", "id", "status", "results", "expiresAt", "creditsUsed", "tokensUsed"],
  "properties": {
    "success": {"type": "boolean"},
    "id": {"type": "string"},
    "status": {"type": "string", "enum": ["processing", "cancelling", "completed", "failed", "cancelled"]},
    "results": { ... },
    ...
  }
}

Server response (V2ExtractStatusResponse in crates/crw-server/src/routes/v2/extract.rs:100-110):

{
  "success": true,
  "status": "completed",
  "data": { ... },
  "error": null,
  "expiresAt": "...",
  "creditsUsed": 1,
  "tokensUsed": 488
}

Missing from response: id (not in the struct), results (has data instead)
Extra in response: data (not in schema)

Impact

Both extract tools are unusable via MCP — every call fails schema validation, even though the server processes the request correctly. The extraction feature itself works (verified via REST /v1/scrape with formats:["json"] + jsonSchema returning structured JSON from a glm-4.5-air LLM backend).

Version

crw v0.25.2 (server + MCP, same version)

Suggested Fix

Either:

  1. Update the schemas to match the actual response shapes (add urlTrace/warnings/replacement to start schema, change resultsdata in status schema, remove id from status required), or
  2. Update the server responses to match the schemas (add status/urls to start response, rename dataresults in status response, add id echo back)

Option 1 is likely safer — the response shapes are already deployed and being consumed by REST clients.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions