MCPcopy Index your code
hub / github.com/coder/coder / RegisterTools

Method RegisterTools

coderd/mcp/mcp.go:75–97  ·  view source on GitHub ↗

Register all available MCP tools with the server excluding: - ReportTask - which requires dependencies not available in the remote MCP context - ChatGPT search and fetch tools, which are redundant with the standard tools.

(client *codersdk.Client, opts ...func(*toolsdk.Deps))

Source from the content-addressed store, hash-verified

73// - ReportTask - which requires dependencies not available in the remote MCP context
74// - ChatGPT search and fetch tools, which are redundant with the standard tools.
75func (s *Server) RegisterTools(client *codersdk.Client, opts ...func(*toolsdk.Deps)) error {
76 if client == nil {
77 return xerrors.New("client cannot be nil: MCP HTTP server requires authenticated client")
78 }
79
80 // Create tool dependencies
81 toolDeps, err := toolsdk.NewDeps(client, opts...)
82 if err != nil {
83 return xerrors.Errorf("failed to initialize tool dependencies: %w", err)
84 }
85
86 for _, tool := range toolsdk.All {
87 // the ReportTask tool requires dependencies not available in the remote MCP context
88 // the ChatGPT search and fetch tools are redundant with the standard tools.
89 if tool.Name == toolsdk.ToolNameReportTask ||
90 tool.Name == toolsdk.ToolNameChatGPTSearch || tool.Name == toolsdk.ToolNameChatGPTFetch {
91 continue
92 }
93
94 s.mcpServer.AddTools(mcpFromSDK(tool, toolDeps))
95 }
96 return nil
97}
98
99// ChatGPT tools are the search and fetch tools as defined in https://platform.openai.com/docs/mcp.
100// We do not expose any extra ones because ChatGPT has an undocumented "Safety Scan" feature.

Callers 2

mcpHTTPHandlerMethod · 0.95

Calls 4

NewDepsFunction · 0.92
mcpFromSDKFunction · 0.70
NewMethod · 0.65
ErrorfMethod · 0.45

Tested by 1