improve error handling for tools and server methods (#311)
- Fix tool error handling to properly distinguish between protocol errors and tool execution errors - Return structured JSON-RPC errors directly for protocol-level issues - Embed regular tool errors in CallToolResult as per MCP specification - Improve server error responses for unknown prompts and tools - Add comprehensive tests for both structured and regular error handling
This commit is contained in:
parent
8e6ab130d8
commit
719f68d0bf
1 changed files with 113 additions and 5 deletions
|
|
@ -311,6 +311,8 @@ const (
|
|||
CodeResourceNotFound = -32002
|
||||
// The error code if the method exists and was called properly, but the peer does not support it.
|
||||
CodeUnsupportedMethod = -31001
|
||||
// The error code for invalid parameters
|
||||
CodeInvalidParams = -32602
|
||||
)
|
||||
|
||||
// notifySessions calls Notify on all the sessions.
|
||||
|
|
|
|||
Loading…
Reference in a new issue