Skip to content

[MCP Bundle] Allow for is_error control on tool call return #807

@EdouardCourty

Description

@EdouardCourty

Hi, currently tool calling supports returning dependents of Content, strings and arrays.
However, it is not possible to control the value of the is_error key.

I suggest implementing a way to control this value, maybe by either :

  • Throwing a specific exception (like ToolErrorException which would be caught in special way
  • Forcing the tools to return an instance of Content or a ToolResult class that could contain an array of contents, and a is_error boolean

I personally think the second option is best, since it would standardise the way tool calls are done.
That's what I had done in my own implementation of MCP here : https://github.com/EdouardCourty/mcp-server-bundle/blob/main/src/DependencyInjection/CompilerPass/ToolPass.php#L90, and it worked really well!

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCP BundleIssues & PRs about the MCP SDK integration bundleRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions