Skip to main content
Glama

CentralMind/Gateway

server_tools_test.go978 B
package mcpgenerator import ( "context" "testing" "github.com/centralmind/gateway/mcp" "github.com/centralmind/gateway/model" "github.com/stretchr/testify/assert" ) func TestSetToolsIncludesDescription(t *testing.T) { srv, err := New(nil) assert.NoError(t, err) ctx := context.Background() // initialize server to enable tools capabilities _ = srv.Server().HandleMessage(ctx, []byte(`{"jsonrpc":"2.0","id":1,"method":"initialize"}`)) endpoint := model.Endpoint{ MCPMethod: "test_method", Description: "sample description", Params: []model.EndpointParams{ {Name: "id", Type: "string"}, }, } srv.SetTools([]model.Endpoint{endpoint}) resp := srv.Server().HandleMessage(ctx, []byte(`{"jsonrpc":"2.0","id":2,"method":"tools/list"}`)) listResp, ok := resp.(mcp.JSONRPCResponse) assert.True(t, ok) tools := listResp.Result.(mcp.ListToolsResult).Tools if assert.Len(t, tools, 1) { assert.Equal(t, "sample description", tools[0].Description) } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/centralmind/gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server