Skip to content

Commit a7d55cd

Browse files
Merge pull request #62 from ibuildthecloud/main
chore: add ToolDefsToNodes helper method
2 parents c0fb2e8 + f243c37 commit a7d55cd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tool.go

+14
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ type ToolDef struct {
3333
MetaData map[string]string `json:"metadata,omitempty"`
3434
}
3535

36+
func ToolDefsToNodes(tools []ToolDef) []Node {
37+
nodes := make([]Node, 0, len(tools))
38+
for _, tool := range tools {
39+
nodes = append(nodes, Node{
40+
ToolNode: &ToolNode{
41+
Tool: Tool{
42+
ToolDef: tool,
43+
},
44+
},
45+
})
46+
}
47+
return nodes
48+
}
49+
3650
func ObjectSchema(kv ...string) *openapi3.Schema {
3751
s := &openapi3.Schema{
3852
Type: &openapi3.Types{"object"},

0 commit comments

Comments
 (0)