Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('Schema handling error recovery', () => {
expect(description).toContain('content')
})

test('buildToolDescription preserves MCP params when schema is represented as allOf', () => {
test('buildToolDescription preserves MCP params from converted schema', () => {
const mcpSchema = convertJsonSchemaToZod({
type: 'object',
properties: {
Expand All @@ -221,8 +221,8 @@ describe('Schema handling error recovery', () => {

expect(description).toContain('greet__greet')
expect(description).toContain('Params: {')
expect(description).toContain('allOf')
expect(description).toContain('name')
expect(description).toContain('cb_easp')
expect(description).not.toContain('Params: None')
})

Expand Down
6 changes: 5 additions & 1 deletion packages/agent-runtime/src/templates/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ function ensureJsonSchemaCompatible(schema: z.ZodType): z.ZodType {
return schema
} catch {
const fallback = z.object({}).passthrough()
return schema.description ? fallback.describe(schema.description) : fallback
try {
return schema.description ? fallback.describe(schema.description) : fallback
} catch {
return fallback
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion packages/agent-runtime/src/tools/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ function ensureJsonSchemaCompatible(schema: z.ZodType): z.ZodType {
return schema
} catch {
const fallback = z.object({}).passthrough()
return schema.description ? fallback.describe(schema.description) : fallback
try {
return schema.description ? fallback.describe(schema.description) : fallback
} catch {
return fallback
}
}
}

Expand Down
Loading