all: remove ServerRequest[T] for concrete T (#342)
Replace all occurrences of ServerRequest[*CallToolParams] and other concrete instantiations with CallToolRequest and the like. Make the XXXRequest types aliases, to preserve the convenience of generics for the internal machinery (see shared.go, for example.) I will expand the aliases in a followup PR.
This commit is contained in:
parent
43ad1eb8b4
commit
6378df6f24
1 changed files with 107 additions and 89 deletions
|
|
@ -61,7 +61,7 @@ func TestToolErrorHandling(t *testing.T) {
|
|||
server := NewServer(testImpl, nil)
|
||||
|
||||
// Create a tool that returns a structured error
|
||||
structuredErrorHandler := func(ctx context.Context, req *ServerRequest[*CallToolParams], args map[string]any) (*CallToolResult, any, error) {
|
||||
structuredErrorHandler := func(ctx context.Context, req *CallToolRequest, args map[string]any) (*CallToolResult, any, error) {
|
||||
return nil, nil, &jsonrpc2.WireError{
|
||||
Code: CodeInvalidParams,
|
||||
Message: "internal server error",
|
||||
|
|
@ -69,7 +69,7 @@ func TestToolErrorHandling(t *testing.T) {
|
|||
}
|
||||
|
||||
// Create a tool that returns a regular error
|
||||
regularErrorHandler := func(ctx context.Context, req *ServerRequest[*CallToolParams], args map[string]any) (*CallToolResult, any, error) {
|
||||
regularErrorHandler := func(ctx context.Context, req *CallToolRequest, args map[string]any) (*CallToolResult, any, error) {
|
||||
return nil, nil, fmt.Errorf("tool execution failed")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue