MCPcopy
hub / github.com/docker/docker-agent / GetPrompt

Method GetPrompt

pkg/tools/mcp/session_client.go:224–250  ·  view source on GitHub ↗
(ctx context.Context, request *gomcp.GetPromptParams)

Source from the content-addressed store, hash-verified

222}
223
224func (c *sessionClient) GetPrompt(ctx context.Context, request *gomcp.GetPromptParams) (*gomcp.GetPromptResult, error) {
225 s := c.getSession()
226 if s == nil {
227 return nil, errors.New("session not initialized")
228 }
229 opts := otelmcp.CallOptions{
230 Method: otelmcp.MethodPromptsGet,
231 SessionID: s.ID(),
232 ServerAddress: c.serverAddress,
233 }
234 if request != nil {
235 opts.PromptName = request.Name
236 }
237 spanCtx, span := otelmcp.StartClient(ctx, opts)
238 defer span.End()
239
240 if request != nil {
241 request.Meta = otelmcp.EnsureMeta(request.Meta)
242 otelmcp.InjectMeta(spanCtx, request.Meta)
243 }
244
245 result, err := s.GetPrompt(spanCtx, request)
246 if err != nil {
247 span.RecordError(err, "")
248 }
249 return result, err
250}
251
252// handleElicitationRequest forwards incoming elicitation requests from the MCP
253// server to the registered handler. It is used as the gomcp ElicitationHandler

Callers

nothing calls this directly

Calls 5

getSessionMethod · 0.95
IDMethod · 0.65
RecordErrorMethod · 0.65
NewMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected