There's a potential ambiguity in the documentation regarding error handling for tools.
In the "Error handling" section, it clearly states:
"Tool errors should be reported within the result object, not as MCP protocol-level errors. This allows the LLM to see and potentially handle the error."
This is the correct approach and is well-documented with examples.
However, in the "Testing tools" section, it states:
"Error handling: Ensure tools properly report errors through the MCP protocol and clean up resources"
This could be interpreted as contradicting the main guideline, as it suggests reporting errors "through the MCP protocol" rather than within the result object.
Suggested fix
Change the text in the "Testing tools" section from:
"Error handling: Ensure tools properly report errors through the MCP protocol and clean up resources"
to one of the following:
"Error handling: Ensure tools properly report errors within the result object (as described in the Error handling section) and clean up resources"
or alternatively:
"Error handling: Ensure tools properly handle errors according to the MCP guidelines (by using isError flag in the result object) and clean up resources"
This would eliminate the ambiguity and make the documentation more consistent.
There's a potential ambiguity in the documentation regarding error handling for tools.
In the "Error handling" section, it clearly states:
This is the correct approach and is well-documented with examples.
However, in the "Testing tools" section, it states:
This could be interpreted as contradicting the main guideline, as it suggests reporting errors "through the MCP protocol" rather than within the result object.
Suggested fix
Change the text in the "Testing tools" section from:
to one of the following:
or alternatively:
This would eliminate the ambiguity and make the documentation more consistent.