@@ -4,38 +4,38 @@ import (
4
4
"fmt"
5
5
"strings"
6
6
7
- humav2 "github.com/danielgtaylor/huma/v2 "
7
+ "github.com/modelcontextprotocol/go-sdk/jsonschema "
8
8
)
9
9
10
10
// ToolDef struct represents a tool with various configurations.
11
11
type ToolDef struct {
12
- Name string `json:"name,omitempty"`
13
- Description string `json:"description,omitempty"`
14
- MaxTokens int `json:"maxTokens,omitempty"`
15
- ModelName string `json:"modelName,omitempty"`
16
- ModelProvider bool `json:"modelProvider,omitempty"`
17
- JSONResponse bool `json:"jsonResponse,omitempty"`
18
- Chat bool `json:"chat,omitempty"`
19
- Temperature * float32 `json:"temperature,omitempty"`
20
- Cache * bool `json:"cache,omitempty"`
21
- InternalPrompt * bool `json:"internalPrompt"`
22
- Arguments * humav2 .Schema `json:"arguments,omitempty"`
23
- Tools []string `json:"tools,omitempty"`
24
- GlobalTools []string `json:"globalTools,omitempty"`
25
- GlobalModelName string `json:"globalModelName,omitempty"`
26
- Context []string `json:"context,omitempty"`
27
- ExportContext []string `json:"exportContext,omitempty"`
28
- Export []string `json:"export,omitempty"`
29
- Agents []string `json:"agents,omitempty"`
30
- Credentials []string `json:"credentials,omitempty"`
31
- ExportCredentials []string `json:"exportCredentials,omitempty"`
32
- InputFilters []string `json:"inputFilters,omitempty"`
33
- ExportInputFilters []string `json:"exportInputFilters,omitempty"`
34
- OutputFilters []string `json:"outputFilters,omitempty"`
35
- ExportOutputFilters []string `json:"exportOutputFilters,omitempty"`
36
- Instructions string `json:"instructions,omitempty"`
37
- Type string `json:"type,omitempty"`
38
- MetaData map [string ]string `json:"metadata,omitempty"`
12
+ Name string `json:"name,omitempty"`
13
+ Description string `json:"description,omitempty"`
14
+ MaxTokens int `json:"maxTokens,omitempty"`
15
+ ModelName string `json:"modelName,omitempty"`
16
+ ModelProvider bool `json:"modelProvider,omitempty"`
17
+ JSONResponse bool `json:"jsonResponse,omitempty"`
18
+ Chat bool `json:"chat,omitempty"`
19
+ Temperature * float32 `json:"temperature,omitempty"`
20
+ Cache * bool `json:"cache,omitempty"`
21
+ InternalPrompt * bool `json:"internalPrompt"`
22
+ Arguments * jsonschema .Schema `json:"arguments,omitempty"`
23
+ Tools []string `json:"tools,omitempty"`
24
+ GlobalTools []string `json:"globalTools,omitempty"`
25
+ GlobalModelName string `json:"globalModelName,omitempty"`
26
+ Context []string `json:"context,omitempty"`
27
+ ExportContext []string `json:"exportContext,omitempty"`
28
+ Export []string `json:"export,omitempty"`
29
+ Agents []string `json:"agents,omitempty"`
30
+ Credentials []string `json:"credentials,omitempty"`
31
+ ExportCredentials []string `json:"exportCredentials,omitempty"`
32
+ InputFilters []string `json:"inputFilters,omitempty"`
33
+ ExportInputFilters []string `json:"exportInputFilters,omitempty"`
34
+ OutputFilters []string `json:"outputFilters,omitempty"`
35
+ ExportOutputFilters []string `json:"exportOutputFilters,omitempty"`
36
+ Instructions string `json:"instructions,omitempty"`
37
+ Type string `json:"type,omitempty"`
38
+ MetaData map [string ]string `json:"metadata,omitempty"`
39
39
}
40
40
41
41
func ToolDefsToNodes (tools []ToolDef ) []Node {
@@ -52,16 +52,16 @@ func ToolDefsToNodes(tools []ToolDef) []Node {
52
52
return nodes
53
53
}
54
54
55
- func ObjectSchema (kv ... string ) * humav2 .Schema {
56
- s := & humav2 .Schema {
57
- Type : humav2 . TypeObject ,
58
- Properties : make (map [string ]* humav2 .Schema , len (kv )/ 2 ),
55
+ func ObjectSchema (kv ... string ) * jsonschema .Schema {
56
+ s := & jsonschema .Schema {
57
+ Type : "object" ,
58
+ Properties : make (map [string ]* jsonschema .Schema , len (kv )/ 2 ),
59
59
}
60
60
for i , v := range kv {
61
61
if i % 2 == 1 {
62
- s .Properties [kv [i - 1 ]] = & humav2 .Schema {
62
+ s .Properties [kv [i - 1 ]] = & jsonschema .Schema {
63
63
Description : v ,
64
- Type : humav2 . TypeString ,
64
+ Type : "string" ,
65
65
}
66
66
}
67
67
}
0 commit comments