Support old tools/call result structure, if explicitly opted in
This commit is contained in:
parent
b618157c93
commit
1f3dbef66c
1 changed files with 14 additions and 3 deletions
|
|
@ -722,6 +722,13 @@ export const CallToolResultSchema = ResultSchema.extend({
|
|||
isError: z.boolean(),
|
||||
});
|
||||
|
||||
/**
|
||||
* CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
|
||||
*/
|
||||
export const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
|
||||
toolResult: z.unknown(),
|
||||
}));
|
||||
|
||||
/**
|
||||
* Used by the client to invoke a tool provided by the server.
|
||||
*/
|
||||
|
|
@ -1054,6 +1061,7 @@ export const ServerResultSchema = z.union([
|
|||
ListResourceTemplatesResultSchema,
|
||||
ReadResourceResultSchema,
|
||||
CallToolResultSchema,
|
||||
CompatibilityCallToolResultSchema,
|
||||
ListToolsResultSchema,
|
||||
]);
|
||||
|
||||
|
|
@ -1148,6 +1156,7 @@ export type Tool = z.infer<typeof ToolSchema>;
|
|||
export type ListToolsRequest = z.infer<typeof ListToolsRequestSchema>;
|
||||
export type ListToolsResult = z.infer<typeof ListToolsResultSchema>;
|
||||
export type CallToolResult = z.infer<typeof CallToolResultSchema>;
|
||||
export type CompatibilityCallToolResult = z.infer<typeof CompatibilityCallToolResultSchema>;
|
||||
export type CallToolRequest = z.infer<typeof CallToolRequestSchema>;
|
||||
export type ToolListChangedNotification = z.infer<
|
||||
typeof ToolListChangedNotificationSchema
|
||||
|
|
|
|||
Loading…
Reference in a new issue