fix(core): expose MCP output schemas to code mode (#35502)
This commit is contained in:
parent
50a762e7b9
commit
4e019ba5d9
5 changed files with 106 additions and 2 deletions
|
|
@ -61,6 +61,7 @@ export interface ToolDefinition {
|
|||
readonly name: string
|
||||
readonly description: string | undefined
|
||||
readonly inputSchema: unknown
|
||||
readonly outputSchema: unknown
|
||||
}
|
||||
|
||||
export interface PromptDefinition {
|
||||
|
|
@ -235,6 +236,7 @@ export const connect = Effect.fnUntraced(function* (
|
|||
name: tool.name,
|
||||
description: tool.description,
|
||||
inputSchema: tool.inputSchema,
|
||||
outputSchema: "outputSchema" in tool ? tool.outputSchema : undefined,
|
||||
}))
|
||||
}),
|
||||
prompts: () =>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export class Tool extends Schema.Class<Tool>("MCP.Tool")({
|
|||
name: Schema.String,
|
||||
description: Schema.String.pipe(Schema.optional),
|
||||
inputSchema: Schema.Unknown.pipe(Schema.optional),
|
||||
outputSchema: Schema.Unknown.pipe(Schema.optional),
|
||||
}) {}
|
||||
|
||||
export const ToolResultContent = Schema.Union([
|
||||
|
|
@ -391,7 +392,13 @@ export const layer = Layer.effect(
|
|||
} satisfies MCPClient.ElicitationHandler
|
||||
|
||||
const toTool = (server: ServerName, def: MCPClient.ToolDefinition) =>
|
||||
new Tool({ server, name: def.name, description: def.description, inputSchema: def.inputSchema })
|
||||
new Tool({
|
||||
server,
|
||||
name: def.name,
|
||||
description: def.description,
|
||||
inputSchema: def.inputSchema,
|
||||
outputSchema: def.outputSchema,
|
||||
})
|
||||
|
||||
const toPrompt = (server: ServerName, def: MCPClient.PromptDefinition) =>
|
||||
new Prompt({
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export const layer = Layer.effectDiscard(
|
|||
properties: schema.properties ?? {},
|
||||
additionalProperties: false,
|
||||
},
|
||||
outputSchema: tool.outputSchema as JsonSchema.JsonSchema | undefined,
|
||||
execute: (input, context) =>
|
||||
Effect.gen(function* () {
|
||||
yield* permission.assert({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue