MCPcopy
hub / github.com/googleapis/mcp-toolbox / ProcessMethod

Function ProcessMethod

internal/server/mcp/vdraft/method.go:40–56  ·  view source on GitHub ↗

ProcessMethod returns a response for the request.

(ctx context.Context, id jsonrpc.RequestId, method string, toolset tools.Toolset, promptset prompts.Promptset, resourceMgr *resources.ResourceManager, body []byte, header http.Header)

Source from the content-addressed store, hash-verified

38
39// ProcessMethod returns a response for the request.
40func ProcessMethod(ctx context.Context, id jsonrpc.RequestId, method string, toolset tools.Toolset, promptset prompts.Promptset, resourceMgr *resources.ResourceManager, body []byte, header http.Header) (any, error) {
41 switch method {
42 case SERVER_DISCOVER:
43 return serverDiscoverHandler(ctx, id, body, header)
44 case TOOLS_LIST:
45 return toolsListHandler(ctx, id, resourceMgr, toolset, body, header)
46 case TOOLS_CALL:
47 return toolsCallHandler(ctx, id, toolset, resourceMgr, body, header)
48 case PROMPTS_LIST:
49 return promptsListHandler(ctx, id, resourceMgr, promptset, body, header)
50 case PROMPTS_GET:
51 return promptsGetHandler(ctx, id, promptset, resourceMgr, body, header)
52 default:
53 err := fmt.Errorf("invalid method %s", method)
54 return jsonrpc.NewError(id, jsonrpc.METHOD_NOT_FOUND, err.Error(), nil), err
55 }
56}
57
58// validateMetadata checks the metadata of every requests
59func validateMetadata(id jsonrpc.RequestId, params RequestParams, stdio bool) (any, error) {

Callers 1

ProcessMethodFunction · 0.92

Calls 7

NewErrorFunction · 0.92
serverDiscoverHandlerFunction · 0.85
toolsListHandlerFunction · 0.70
toolsCallHandlerFunction · 0.70
promptsListHandlerFunction · 0.70
promptsGetHandlerFunction · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected