mcp: change tool handler design (#325)
Change the design of tool handlers by removing genericity from the common path. - `ToolHandler` gets the args as a `json.RawMessage`. Using Server.AddTool does no unmarshaling or schema validation. - `ToolHandlerFor`, installed with `AddTool`, are the only generic pieces. TODO: uncomment and fix some tests
This commit is contained in:
parent
79f063bc98
commit
32cf71de3a
1 changed files with 789 additions and 966 deletions
|
|
@ -208,6 +208,7 @@ func TestCompleteReference(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompleteParams(t *testing.T) {
|
||||
// Define test cases specifically for Marshalling
|
||||
marshalTests := []struct {
|
||||
|
|
@ -514,13 +515,13 @@ func TestContentUnmarshal(t *testing.T) {
|
|||
var got CallToolResult
|
||||
roundtrip(ctr, &got)
|
||||
|
||||
ctrf := &CallToolResultFor[int]{
|
||||
ctrf := &CallToolResult{
|
||||
Meta: Meta{"m": true},
|
||||
Content: content,
|
||||
IsError: true,
|
||||
StructuredContent: 3,
|
||||
StructuredContent: 3.0,
|
||||
}
|
||||
var gotf CallToolResultFor[int]
|
||||
var gotf CallToolResult
|
||||
roundtrip(ctrf, &gotf)
|
||||
|
||||
pm := &PromptMessage{
|
||||
|
|
|
|||
Loading…
Reference in a new issue