You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-13Lines changed: 11 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -834,6 +834,8 @@ Caution: The `mcp run` and `mcp dev` tool doesn't support low-level server.
834
834
The low-level server supports structured output for tools, allowing you to return both human-readable content and machine-readable structured data. Tools can define an `outputSchema` to validate their structured output:
# low-level server will validate structured output against the tool's
879
+
# output schema, and automatically serialize it into a TextContent block
880
+
# for backwards compatibility with pre-2025-06-18 clients.
881
+
return structured
884
882
exceptExceptionas e:
885
883
raiseValueError(f"Calculation error: {str(e)}")
886
884
```
887
885
888
886
Tools can return data in three ways:
889
-
1.**Content only**: Return a list of content blocks (default behavior)
890
-
2.**Structured data only**: Return a dictionary that will be serialized to JSON
891
-
3.**Both**: Return a tuple of (content, structured_data)
887
+
1.**Content only**: Return a list of content blocks (default behavior before spec revision 2025-06-18)
888
+
2.**Structured data only**: Return a dictionary that will be serialized to JSON (Introduced in spec revision 2025-06-18)
889
+
3.**Both**: Return a tuple of (content, structured_data) preferred option to use for backwards compatibility
892
890
893
891
When an `outputSchema` is defined, the server automatically validates the structured output against the schema. This ensures type safety and helps catch errors early.
0 commit comments