28 lines
538 B
Go
28 lines
538 B
Go
package mcp
|
|
|
|
import (
|
|
"ai-agent/internal/llm"
|
|
)
|
|
|
|
type ServerInfo struct {
|
|
Name string
|
|
ToolCount int
|
|
}
|
|
|
|
type ToolResult struct {
|
|
Content string
|
|
IsError bool
|
|
}
|
|
|
|
func ToLLMToolDef(name, description string, inputSchema any) llm.ToolDef {
|
|
params, _ := inputSchema.(map[string]any)
|
|
if params == nil {
|
|
params = map[string]any{"type": "object", "properties": map[string]any{}}
|
|
}
|
|
return llm.ToolDef{
|
|
Name: name,
|
|
Description: description,
|
|
Parameters: params,
|
|
}
|
|
}
|