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:
Jonathan Amsterdam 2025-08-21 12:10:53 -04:00 • committed by GitHub
commit 6378df6f24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -387,11 +387,11 @@ func TestThinkingHistory(t *testing.T) {
ctx := context.Background()
// Test listing all sessions
listParams := &mcp.ReadResourceParams{
URI: "thinking://sessions",
}
result, err := ThinkingHistory(ctx, requestFor(listParams))
result, err := ThinkingHistory(ctx, &mcp.ReadResourceRequest{
Params: &mcp.ReadResourceParams{
URI: "thinking://sessions",
},
})
if err != nil {
t.Fatalf("ThinkingHistory() error = %v", err)
}
@ -417,11 +417,9 @@ func TestThinkingHistory(t *testing.T) {
}
// Test getting specific session
sessionParams := &mcp.ReadResourceParams{
URI: "thinking://session1",
}
result, err = ThinkingHistory(ctx, requestFor(sessionParams))
result, err = ThinkingHistory(ctx, &mcp.ReadResourceRequest{
Params: &mcp.ReadResourceParams{URI: "thinking://session1"},
})
if err != nil {
t.Fatalf("ThinkingHistory() error = %v", err)
}
@ -491,7 +489,3 @@ func TestInvalidOperations(t *testing.T) {
t.Error("Expected error for invalid revision step")
}
}
func requestFor[P mcp.Params](p P) *mcp.ServerRequest[P] {
return &mcp.ServerRequest[P]{Params: p}
}