LearnNewsExamplesServices
Frontmatter
id7608
titleBug: `get_pull_request_diff` Fails Schema Validation Due to Raw String Output
stateClosed
labels
bugai
assigneestobiu
createdAtOct 22, 2025, 2:29 PM
updatedAtOct 22, 2025, 2:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/7608
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 22, 2025, 2:30 PM

Bug: get_pull_request_diff Fails Schema Validation Due to Raw String Output

Closed v11.0.0 bugai
tobiu
tobiu commented on Oct 22, 2025, 2:29 PM

When calling the get_pull_request_diff tool, the operation fails with the error: MCP error -32600: Structured content does not match the tool's output schema: data should NOT have additional properties.

Root Cause

An investigation revealed a mismatch between the PullRequestService.getPullRequestDiff implementation and the expectations of the generic toolService.

  1. OpenAPI Definition: The openapi.yaml correctly defines the response for this endpoint as text/plain.
  2. Tool Service Behavior: The generic toolService.mjs, when it encounters a text/plain response type, wraps the output schema in a JSON object for client compatibility. It expects the tool's handler to return a JSON object of the shape { "result": "..." }.
  3. Service Implementation: The PullRequestService.getPullRequestDiff method currently returns the raw string output (stdout) from the gh pr diff command, not a JSON object.

This discrepancy causes the tool's output validation to fail.

Resolution

The getPullRequestDiff method in ai/mcp/server/github-workflow/services/PullRequestService.mjs needs to be modified. Instead of returning the raw stdout string, it must return a JSON object that conforms to the structure expected by the tool service:

// Current incorrect return value
return stdout;

// Required correct return value
return { result: stdout };

This will align the service's output with the tool's schema, resolving the validation error.

tobiu assigned to @tobiu on Oct 22, 2025, 2:29 PM
tobiu added the bug label on Oct 22, 2025, 2:30 PM
tobiu added the ai label on Oct 22, 2025, 2:30 PM
tobiu referenced in commit 800b798 - "Bug: get_pull_request_diff Fails Schema Validation Due to Raw String Output #7608" on Oct 22, 2025, 2:30 PM
tobiu closed this issue on Oct 22, 2025, 2:30 PM