-
Notifications
You must be signed in to change notification settings - Fork 70
feat(mcp): parse mcp tool json #1212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: wb/mcp-tool-list-dump
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporarily ignored
52465c1 to
ebb49f7
Compare
e9da8bb to
ea3325b
Compare
ebb49f7 to
9fb4691
Compare
ea3325b to
89494c8
Compare
| OutputSchema SchemaObject `json:"outputSchema"` | ||
| } | ||
|
|
||
| type RawSchema struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
| "testing" | ||
| ) | ||
|
|
||
| func TestLoadToolDefinitions(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Define structures to parse the mcp tool json
items: truePart of SRCH-2167
Test plan
Added testcase and parsed the dumped json