Skip to content

[Server] Let ToolCallException carry structured content - #783

Open
anthonyhacart wants to merge 1 commit into
modelcontextprotocol:mainfrom
anthonyhacart:tool-call-exception-structured-content
Open

anthonyhacart wants to merge 1 commit into
modelcontextprotocol:mainfrom
anthonyhacart:tool-call-exception-structured-content

Conversation

@anthonyhacart

Copy link
Copy Markdown

A tool can report a failure with machine-readable details by returning a CallToolResult with isError: true and a structuredContent, but not by throwing a ToolCallException, which only carries a message. This adds a structuredContent argument to the exception, and CallToolHandler sends it as the structuredContent of the error result, with the same warning as for a self-built result when it is not a JSON object before 2026-07-28.

throw new ToolCallException('Invalid input', structuredContent: [
    'violations' => [['field' => 'email', 'message' => 'This value is not a valid email address.']],
]);

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T14:08:59.451754Z 17caf0b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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