MCPcopy
hub / github.com/github/github-mcp-server / createMCPRequest

Function createMCPRequest

pkg/github/helper_test.go:315–334  ·  view source on GitHub ↗

createMCPRequest is a helper function to create a MCP request with the given arguments.

(args any)

Source from the content-addressed store, hash-verified

313
314// createMCPRequest is a helper function to create a MCP request with the given arguments.
315func createMCPRequest(args any) mcp.CallToolRequest {
316 // convert args to map[string]interface{} and serialize to JSON
317 argsMap, ok := args.(map[string]any)
318 if !ok {
319 argsMap = make(map[string]any)
320 }
321
322 argsJSON, err := json.Marshal(argsMap)
323 if err != nil {
324 return mcp.CallToolRequest{}
325 }
326
327 jsonRawMessage := json.RawMessage(argsJSON)
328
329 return mcp.CallToolRequest{
330 Params: &mcp.CallToolParamsRaw{
331 Arguments: jsonRawMessage,
332 },
333 }
334}
335
336// Well-known MCP client names used in tests.
337const (

Calls

no outgoing calls

Tested by

no test coverage detected