-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: ToolError migration to ErrorData #4051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
8b8d07b to
d2d3488
Compare
jamadeo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, landing with a bug or two might be preferable to keeping up with merge conflicts. Added copilot as a reviewer to see if it catches anything -- might not, but worth a shot.
Good stuff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates all internal usage of the MCP crate's ToolError concept to rmcp's ErrorData type. The migration includes both automated conversions using the ErrorData { ... } variant and the preferred ErrorData::new(...) method for new error constructions.
- Migration from
ToolErrorenum toErrorDatastruct across all tool implementations - Updated error handling patterns to use proper error codes from rmcp's
ErrorCodeenum - Conversion of test assertions to check for new error structure
Reviewed Changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| documentation/docs/goose-architecture/extensions-design.md | Updated documentation to reference ErrorData instead of ToolError |
| crates/mcp-server/src/router.rs | Updated router trait to use ErrorData in tool execution signatures |
| crates/mcp-server/src/main.rs | Converted example router implementation to use ErrorData |
| crates/mcp-core/src/lib.rs | Removed ToolError from public exports |
| crates/mcp-core/src/handler.rs | Replaced ToolError enum with ErrorData usage in helper functions |
| crates/goose/tests/private_tests.rs | Updated test assertions to check ErrorData fields instead of ToolError variants |
| crates/goose/src/providers/formats/*.rs | Migrated provider format handlers to use ErrorData |
| crates/goose/src/conversation/*.rs | Updated conversation handling to use new error format |
| crates/goose/src/agents/*.rs | Converted all agent tool implementations to use ErrorData |
| crates/goose-mcp/src/*/mod.rs | Updated MCP extension implementations to use ErrorData |
Comments suppressed due to low confidence (1)
crates/mcp-core/src/handler.rs:59
- Error message is incorrect - should say 'must be a number' but the parameter name suggests it should be 'must be required'. This appears to be a copy-paste error from the require_str_parameter function.
format!("The parameter {name} is required"),
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ToolError::ExecutionError(format!("Sub-recipe task createion failed: {}", e)) | ||
| .map_err(|e| ErrorData { | ||
| code: ErrorCode::INTERNAL_ERROR, | ||
| message: Cow::from(format!("Sub-recipe task createion failed: {}", e)), |
Copilot
AI
Aug 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'createion' should be 'creation'.
| message: Cow::from(format!("Sub-recipe task createion failed: {}", e)), | |
| message: Cow::from(format!("Sub-recipe task creation failed: {}", e)), |
| Err(ErrorData { | ||
| code: ErrorCode::INTERNAL_ERROR, | ||
| message: Cow::from( | ||
| format!("Suported mimeType {}, for {}", mime_type, uri,), |
Copilot
AI
Aug 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'Suported' should be 'Supported'.
| format!("Suported mimeType {}, for {}", mime_type, uri,), | |
| format!("Supported mimeType {}, for {}", mime_type, uri,), |
|
|
||
| Err(ToolError::InvalidParameters(error_msg)) | ||
| Err(ErrorData::new( | ||
| ErrorCode::RESOURCE_NOT_FOUND, |
Copilot
AI
Aug 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using RESOURCE_NOT_FOUND error code for an invalid parameters scenario is semantically incorrect. Should use INVALID_PARAMS instead.
| ErrorCode::RESOURCE_NOT_FOUND, | |
| ErrorCode::INVALID_PARAMS, |
857a296 to
eaea319
Compare
eaea319 to
29e751d
Compare
* 'main' of github.com:block/goose: feat: ToolError migration to ErrorData (#4051) docs: rename sessions (#4053) Add mcp automated testing blog (#4004) MCP session replay integration test (#3939) Docs: Cost tracking in CLI (#4043) sanitize message content on deserialization (#3966)
* main: docs: mcp-ui support (#4049) fix: delete dialog layout (#4037) ci: fix markdown file pattern to skip builds for all .md files (#4061) docs: add window title (#4059) blog: cleaning up some posts (#4050) fix: this should be a debug message not a warn (#4024) Better provider logging (#4052) feat: ToolError migration to ErrorData (#4051) docs: rename sessions (#4053) Add mcp automated testing blog (#4004)
* 'main' of github.com:block/goose: (120 commits) Docs: Troubleshooting tip - Nodejs path on windows (#4065) fix: flag out uncompilable bit in windows (#4068) ci: fix docs-only filter to properly skip tests for documentation changes (#4066) fix: ctrl-C interruption in the CLI (#4057) docs: mcp-ui support (#4049) fix: delete dialog layout (#4037) ci: fix markdown file pattern to skip builds for all .md files (#4061) docs: add window title (#4059) blog: cleaning up some posts (#4050) fix: this should be a debug message not a warn (#4024) Better provider logging (#4052) feat: ToolError migration to ErrorData (#4051) docs: rename sessions (#4053) Add mcp automated testing blog (#4004) MCP session replay integration test (#3939) Docs: Cost tracking in CLI (#4043) sanitize message content on deserialization (#3966) Move summarize button inside of context view (#4015) blog: post on lead/worker model (#3994) Actually send cancellation to MCP servers (#3865) ...
Signed-off-by: Jack Wright <[email protected]>
Converts all usages of our internal MCP crate
ToolErrorconcept to rmcp'sErrorDataThere were some conversions which were automated and uses the
ErrorData { ... }variant, which requires providing the message manually as astd::borrow::Cowvs theErrorData::new(...)option which allows strings.Related #3578