mcp: fix bugs handling pointer types (#344)
Some bad merging in #338 led to a bad bug in the handling of structured output for pointer output types. Add a conformance test and fix the bug.
This commit is contained in:
parent
6378df6f24
commit
d8e18b34cf
1 changed files with 46 additions and 4 deletions
|
|
@ -206,7 +206,7 @@ func toolForErr[In, Out any](t *Tool, h ToolHandlerFor[In, Out]) (*Tool, ToolHan
|
|||
)
|
||||
if reflect.TypeFor[Out]() != reflect.TypeFor[any]() {
|
||||
var err error
|
||||
elemZero, err = setSchema[Out](&t.OutputSchema, &outputResolved)
|
||||
elemZero, err = setSchema[Out](&tt.OutputSchema, &outputResolved)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("output schema: %v", err)
|
||||
}
|
||||
|
|
@ -258,9 +258,6 @@ func toolForErr[In, Out any](t *Tool, h ToolHandlerFor[In, Out]) (*Tool, ToolHan
|
|||
res.StructuredContent = elemZero
|
||||
}
|
||||
}
|
||||
if tt.OutputSchema != nil && elemZero != nil {
|
||||
res.StructuredContent = elemZero
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue