@@ -843,13 +843,13 @@ export const ToolSchema = z
843
843
* If not set, a CallToolResult for this Tool MUST NOT contain a structuredContent field and MUST contain a content field.
844
844
*/
845
845
outputSchema : z . optional (
846
- z . object ( {
847
- type : z . literal ( "object" ) ,
848
- properties : z . optional ( z . object ( { } ) . passthrough ( ) ) ,
849
- required : z . optional ( z . array ( z . string ( ) ) ) ,
850
- } )
846
+ z . object ( {
847
+ type : z . literal ( "object" ) ,
848
+ properties : z . optional ( z . object ( { } ) . passthrough ( ) ) ,
849
+ required : z . optional ( z . array ( z . string ( ) ) ) ,
850
+ } )
851
851
. passthrough ( )
852
- ) ,
852
+ ) ,
853
853
/**
854
854
* Optional additional tool information.
855
855
*/
@@ -892,46 +892,21 @@ export const ContentListSchema = z.array(
892
892
] ) ,
893
893
) ;
894
894
895
- export const CallToolUnstructuredResultSchema = ResultSchema . extend ( {
895
+ export const CallToolResultSchema = ResultSchema . extend ( {
896
896
/**
897
897
* A list of content objects that represent the result of the tool call.
898
898
*
899
899
* If the Tool does not define an outputSchema, this field MUST be present in the result.
900
+ * For backwards compatibility, this field is always present, but it may be empty.
900
901
*/
901
- content : ContentListSchema ,
902
-
903
- /**
904
- * Structured output must not be provided in an unstructured tool result.
905
- */
906
- structuredContent : z . never ( ) . optional ( ) ,
907
-
908
- /**
909
- * Whether the tool call ended in an error.
910
- *
911
- * If not set, this is assumed to be false (the call was successful).
912
- */
913
- isError : z . optional ( z . boolean ( ) ) ,
914
- } ) ;
902
+ content : ContentListSchema . default ( [ ] ) ,
915
903
916
- export const CallToolStructuredResultSchema = ResultSchema . extend ( {
917
904
/**
918
905
* An object containing structured tool output.
919
906
*
920
907
* If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
921
908
*/
922
- structuredContent : z . object ( { } ) . passthrough ( ) ,
923
-
924
- /**
925
- * A list of content objects that represent the result of the tool call.
926
- *
927
- * If the Tool defines an outputSchema, this field MAY be present in the result.
928
- *
929
- * Tools may use this field to provide compatibility with older clients that
930
- * do not support structured content.
931
- *
932
- * Clients that support structured content should ignore this field.
933
- */
934
- content : z . optional ( ContentListSchema ) ,
909
+ structuredContent : z . object ( { } ) . passthrough ( ) . optional ( ) ,
935
910
936
911
/**
937
912
* Whether the tool call ended in an error.
@@ -941,11 +916,6 @@ export const CallToolStructuredResultSchema = ResultSchema.extend({
941
916
isError : z . optional ( z . boolean ( ) ) ,
942
917
} ) ;
943
918
944
- export const CallToolResultSchema = z . union ( [
945
- CallToolUnstructuredResultSchema ,
946
- CallToolStructuredResultSchema ,
947
- ] ) ;
948
-
949
919
/**
950
920
* CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
951
921
*/
@@ -1397,8 +1367,6 @@ export type Tool = Infer<typeof ToolSchema>;
1397
1367
export type ListToolsRequest = Infer < typeof ListToolsRequestSchema > ;
1398
1368
export type ListToolsResult = Infer < typeof ListToolsResultSchema > ;
1399
1369
export type ContentList = Infer < typeof ContentListSchema > ;
1400
- export type CallToolUnstructuredResult = Infer < typeof CallToolUnstructuredResultSchema > ;
1401
- export type CallToolStructuredResult = Infer < typeof CallToolStructuredResultSchema > ;
1402
1370
export type CallToolResult = Infer < typeof CallToolResultSchema > ;
1403
1371
export type CompatibilityCallToolResult = Infer < typeof CompatibilityCallToolResultSchema > ;
1404
1372
export type CallToolRequest = Infer < typeof CallToolRequestSchema > ;
0 commit comments