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

Method listPrompts

mcp/server.go:701–713  ·  view source on GitHub ↗
(_ context.Context, req *ListPromptsRequest)

Source from the content-addressed store, hash-verified

699}
700
701func (s *Server) listPrompts(_ context.Context, req *ListPromptsRequest) (*ListPromptsResult, error) {
702 s.mu.Lock()
703 defer s.mu.Unlock()
704 if req.Params == nil {
705 req.Params = &ListPromptsParams{}
706 }
707 return paginateList(s.prompts, s.opts.PageSize, req.Params, &ListPromptsResult{}, func(res *ListPromptsResult, prompts []*serverPrompt) {
708 res.Prompts = []*Prompt{} // avoid JSON null
709 for _, p := range prompts {
710 res.Prompts = append(res.Prompts, p.prompt)
711 }
712 })
713}
714
715func (s *Server) getPrompt(ctx context.Context, req *GetPromptRequest) (*GetPromptResult, error) {
716 s.mu.Lock()

Callers

nothing calls this directly

Calls 1

paginateListFunction · 0.85

Tested by

no test coverage detected