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

Function runSubagentTool

coderd/x/chatd/subagent_internal_test.go:830–860  ·  view source on GitHub ↗
(
	ctx context.Context,
	t *testing.T,
	server *Server,
	parentChat database.Chat,
	currentModelConfigID uuid.UUID,
	toolName string,
	args any,
)

Source from the content-addressed store, hash-verified

828}
829
830func runSubagentTool(
831 ctx context.Context,
832 t *testing.T,
833 server *Server,
834 parentChat database.Chat,
835 currentModelConfigID uuid.UUID,
836 toolName string,
837 args any,
838) fantasy.ToolResponse {
839 t.Helper()
840
841 tools := server.subagentTools(
842 ctx,
843 func() database.Chat { return parentChat },
844 currentModelConfigID,
845 )
846 tool := findToolByName(tools, toolName)
847 require.NotNil(t, tool, "%s tool must be present", toolName)
848
849 input, err := json.Marshal(args)
850 require.NoError(t, err)
851
852 resp, err := tool.Run(ctx, fantasy.ToolCall{
853 ID: uuid.NewString(),
854 Name: toolName,
855 Input: string(input),
856 })
857 require.NoError(t, err)
858
859 return resp
860}
861
862func runSpawnAgentTool(
863 ctx context.Context,

Calls 5

findToolByNameFunction · 0.85
subagentToolsMethod · 0.80
HelperMethod · 0.65
RunMethod · 0.65
MarshalMethod · 0.45

Tested by

no test coverage detected