feat(mcp): parse mcp tool json#1212
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
a421135 to
49c64b7
Compare
b795d99 to
73b6673
Compare
49c64b7 to
52465c1
Compare
73b6673 to
4c6a6bd
Compare
| ) | ||
|
|
||
| //go:embed mcp_tools.json | ||
| var _ []byte |
There was a problem hiding this comment.
temporarily ignored
52465c1 to
ebb49f7
Compare
e9da8bb to
ea3325b
Compare
ebb49f7 to
9fb4691
Compare
ea3325b to
89494c8
Compare
internal/mcp/mcp_parse.go
Outdated
| OutputSchema SchemaObject `json:"outputSchema"` | ||
| } | ||
|
|
||
| type RawSchema struct { |
There was a problem hiding this comment.
minor: you might as well only define the fields on these structs you will actually end up reading.
And my favourite nit: probably not used outside of this package so don't export.
| return nil, err | ||
| } | ||
|
|
||
| tools := map[string]*ToolDef{} |
There was a problem hiding this comment.
minor: is there any chance the tool order matters? I think in the backend we also use a map and just sort by name when serializing for determinism, but I can't remember.
| type SchemaValue interface { | ||
| ValueType() string | ||
| } |
There was a problem hiding this comment.
can't we remove SchemaValue and just use a normal go interface? Then we just have some sort of standard set of go types we could marshal into (same as how the json library works in go)
There was a problem hiding this comment.
yeah, I had grander plans but in the end didn't need this. Removing it
| "testing" | ||
| ) | ||
|
|
||
| func TestLoadToolDefinitions(t *testing.T) { |
There was a problem hiding this comment.
a nicer test here would probably just load in mcp_tools.json and then assert on some stable tool's properties. eg the read file tool likely won't change.
ca86fe0 to
36ee381
Compare
9fb4691 to
720a04a
Compare
Define structures to parse the mcp tool json
items: truePart of SRCH-2167
Test plan
Added testcase and parsed the dumped json