MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / listTools

Method listTools

mcp/server.go:729–741  ·  view source on GitHub ↗
(_ context.Context, req *ListToolsRequest)

Source from the content-addressed store, hash-verified

727}
728
729func (s *Server) listTools(_ context.Context, req *ListToolsRequest) (*ListToolsResult, error) {
730 s.mu.Lock()
731 defer s.mu.Unlock()
732 if req.Params == nil {
733 req.Params = &ListToolsParams{}
734 }
735 return paginateList(s.tools, s.opts.PageSize, req.Params, &ListToolsResult{}, func(res *ListToolsResult, tools []*serverTool) {
736 res.Tools = []*Tool{} // avoid JSON null
737 for _, t := range tools {
738 res.Tools = append(res.Tools, t.tool)
739 }
740 })
741}
742
743func (s *Server) callTool(ctx context.Context, req *CallToolRequest) (*CallToolResult, error) {
744 s.mu.Lock()

Callers

nothing calls this directly

Calls 1

paginateListFunction · 0.85

Tested by

no test coverage detected