fix(mcp): ensure required field if nil (#278)
This commit is contained in:
parent
4427df587f
commit
1f6eef460e
1 changed files with 5 additions and 1 deletions
|
|
@ -33,11 +33,15 @@ type MCPClient interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *mcpTool) Info() tools.ToolInfo {
|
func (b *mcpTool) Info() tools.ToolInfo {
|
||||||
|
required := b.tool.InputSchema.Required
|
||||||
|
if required == nil {
|
||||||
|
required = make([]string, 0)
|
||||||
|
}
|
||||||
return tools.ToolInfo{
|
return tools.ToolInfo{
|
||||||
Name: fmt.Sprintf("%s_%s", b.mcpName, b.tool.Name),
|
Name: fmt.Sprintf("%s_%s", b.mcpName, b.tool.Name),
|
||||||
Description: b.tool.Description,
|
Description: b.tool.Description,
|
||||||
Parameters: b.tool.InputSchema.Properties,
|
Parameters: b.tool.InputSchema.Properties,
|
||||||
Required: b.tool.InputSchema.Required,
|
Required: required,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue