Repository navigation
Keep a remote tool's annotations on McpRemoteTool #104
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fb73534
feat(transport): expose tool annotations on McpRemoteTool
senamakel 0a2cb52
docs(tinymcp-bus): document tool annotations in contract 1.25
senamakel 80183df
test(tinymcp): cover redaction of tool annotations metadata
senamakel ff43df7
fix(processing): scrub tool annotations in scrub_static_tools
senamakel 2279761
docs(tinymcp-bus): note that StaticScrubTools scrubs tool annotations
senamakel 9dbb3f6
chore(tinymcp-bus): add transport module tests
senamakel b20a7d1
Merge branch 'main' into remote-tool-annotations
M3gA-Mind bc99bb6
Merge remote-tracking branch 'refs/remotes/upstream/main' into pr/104
senamakel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| //! The remote tool's wire form, annotations included. | ||
|
|
||
| use serde_json::json; | ||
|
|
||
| use super::*; | ||
|
|
||
| type TestResult = Result<(), serde_json::Error>; | ||
|
|
||
| #[test] | ||
| fn a_listed_tools_annotations_are_kept() -> TestResult { | ||
| let tool: McpRemoteTool = serde_json::from_value(json!({ | ||
| "name": "list_meetings", | ||
| "inputSchema": {"type": "object"}, | ||
| "annotations": {"readOnlyHint": true, "openWorldHint": false}, | ||
| }))?; | ||
|
|
||
| assert_eq!( | ||
| tool.annotations, | ||
| Some(json!({"readOnlyHint": true, "openWorldHint": false})) | ||
| ); | ||
| assert!(tool.is_read_only()); | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[test] | ||
| fn a_tool_without_the_hint_or_with_it_false_is_not_read_only() { | ||
| for annotations in [ | ||
| None, | ||
| Some(json!({})), | ||
| Some(json!({"readOnlyHint": false})), | ||
| Some(json!({"readOnlyHint": "yes"})), | ||
| ] { | ||
| let mut tool = McpRemoteTool::new("sign_out"); | ||
| tool.annotations = annotations.clone(); | ||
| assert!(!tool.is_read_only(), "{annotations:?}"); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn absent_annotations_stay_off_the_wire() -> TestResult { | ||
| let wire = serde_json::to_value(McpRemoteTool::new("forecast"))?; | ||
| assert_eq!( | ||
| wire, | ||
| json!({"name": "forecast", "title": null, "description": null, "inputSchema": null}) | ||
| ); | ||
|
|
||
| let mut annotated = McpRemoteTool::new("forecast"); | ||
| annotated.annotations = Some(json!({"readOnlyHint": true})); | ||
| let wire = serde_json::to_value(&annotated)?; | ||
| assert_eq!(wire["annotations"], json!({"readOnlyHint": true})); | ||
| assert_eq!(serde_json::from_value::<McpRemoteTool>(wire)?, annotated); | ||
| Ok(()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.