generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 461
feat: add optional outputSchema support for tool specifications #818
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
dbschmigelski
merged 9 commits into
strands-agents:main
from
vamgan:feat/add-output-schema-support
Sep 19, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
aacf60d
feat: add optional outputSchema support for tool specifications
25d3bcc
test: add output schema test
dbschmigelski 2e7be00
fix: mcp tests
dbschmigelski 789026e
cleaning and shift pruning
dbschmigelski f3a28a9
remove filtering in event loop
dbschmigelski 2722b60
resync
dbschmigelski 65a4022
linting
dbschmigelski 810a62e
fix test
dbschmigelski afeeaf5
fix mcp test with correct path
dbschmigelski 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
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 @@ | ||
| """MCP integration tests package.""" |
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,44 @@ | ||
| """Integration test for MCP tools with output schema.""" | ||
|
|
||
| from mcp import StdioServerParameters, stdio_client | ||
|
|
||
| from strands.tools.mcp.mcp_client import MCPClient | ||
|
|
||
| from .echo_server import EchoResponse | ||
|
|
||
|
|
||
| def test_mcp_tool_output_schema(): | ||
| """Test that MCP tools with output schema include it in tool spec.""" | ||
| stdio_mcp_client = MCPClient( | ||
| lambda: stdio_client(StdioServerParameters(command="python", args=["tests_integ/mcp/echo_server.py"])) | ||
| ) | ||
|
|
||
| with stdio_mcp_client: | ||
| tools = stdio_mcp_client.list_tools_sync() | ||
|
|
||
| # Find tools with and without output schema | ||
| echo_tool = next(tool for tool in tools if tool.tool_name == "echo") | ||
| structured_tool = next(tool for tool in tools if tool.tool_name == "echo_with_structured_content") | ||
|
|
||
| # Verify echo tool has no output schema | ||
| echo_spec = echo_tool.tool_spec | ||
| assert "outputSchema" not in echo_spec | ||
|
|
||
| # Verify structured tool has output schema | ||
| structured_spec = structured_tool.tool_spec | ||
| assert "outputSchema" in structured_spec | ||
|
|
||
| # Validate output schema matches expected structure | ||
| expected_schema = { | ||
| "description": "Response model for echo with structured content.", | ||
| "properties": { | ||
| "echoed": {"title": "Echoed", "type": "string"}, | ||
| "message_length": {"title": "Message Length", "type": "integer"}, | ||
| }, | ||
| "required": ["echoed", "message_length"], | ||
| "title": "EchoResponse", | ||
| "type": "object", | ||
| } | ||
|
|
||
| assert structured_spec["outputSchema"]["json"] == expected_schema | ||
| assert structured_spec["outputSchema"]["json"] == EchoResponse.model_json_schema() |
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.