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

Function NewWorkspaceMCPTool

coderd/x/chatd/chattool/mcpworkspace.go:34–54  ·  view source on GitHub ↗

NewWorkspaceMCPTool creates a tool wrapper from an MCPToolInfo discovered on a workspace agent. Each tool proxies calls back through the agent connection. The optional invalidateCache callback is invoked when CallMCPTool returns a 404 error, indicating that the server was removed and the chat's cach

(
	tool workspacesdk.MCPToolInfo,
	getConn func(context.Context) (workspacesdk.AgentConn, error),
	invalidateCache func(),
)

Source from the content-addressed store, hash-verified

32// indicating that the server was removed and the chat's cached
33// tool list should be dropped.
34func NewWorkspaceMCPTool(
35 tool workspacesdk.MCPToolInfo,
36 getConn func(context.Context) (workspacesdk.AgentConn, error),
37 invalidateCache func(),
38) *WorkspaceMCPTool {
39 required := tool.Required
40 if required == nil {
41 required = []string{}
42 }
43 return &WorkspaceMCPTool{
44 info: fantasy.ToolInfo{
45 Name: tool.Name,
46 Description: tool.Description,
47 Parameters: tool.Schema,
48 Required: required,
49 Parallel: true,
50 },
51 getConn: getConn,
52 invalidateCache: invalidateCache,
53 }
54}
55
56func (t *WorkspaceMCPTool) Info() fantasy.ToolInfo {
57 return t.info

Calls

no outgoing calls

Tested by 1