MCPcopy Index your code
hub / github.com/continuedev/continue / subagentTool

Function subagentTool

extensions/cli/src/tools/subagent.ts:15–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13import { Tool } from "./types.js";
14
15export const subagentTool = async (): Promise<Tool> => {
16 const modelServiceState = await serviceContainer.get<ModelServiceState>(
17 SERVICE_NAMES.MODEL,
18 );
19
20 return {
21 ...SUBAGENT_TOOL_META,
22
23 description: generateSubagentToolDescription(modelServiceState),
24
25 parameters: {
26 ...SUBAGENT_TOOL_META.parameters,
27 properties: {
28 ...SUBAGENT_TOOL_META.parameters.properties,
29 subagent_name: {
30 type: "string",
31 description: `The type of specialized agent to use for this task. Available agents: ${
32 modelServiceState
33 ? getSubagentNames(modelServiceState).join(", ")
34 : ""
35 }`,
36 },
37 },
38 },
39
40 preprocess: async (args: any) => {
41 const { description, subagent_name } = args;
42
43 const agent = getSubagent(modelServiceState, subagent_name);
44 if (!agent) {
45 throw new Error(
46 `Unknown agent type: ${subagent_name}. Available agents: ${getSubagentNames(
47 modelServiceState,
48 ).join(", ")}`,
49 );
50 }
51
52 return {
53 args,
54 preview: [
55 {
56 type: "text",
57 content: `Spawning ${agent.model.name} to: ${description}`,
58 },
59 ],
60 };
61 },
62
63 run: async (args: any, context?: { toolCallId: string }) => {
64 const { prompt, subagent_name } = args;
65
66 logger.debug("subagent args", { args, context });
67
68 // get agent configuration
69 const agent = getSubagent(modelServiceState, subagent_name);
70 if (!agent) {
71 throw new Error(`Unknown agent type: ${subagent_name}`);
72 }

Callers 2

subagent.test.tsFile · 0.85
getAllAvailableToolsFunction · 0.85

Calls 6

getSubagentFunction · 0.85
executeSubAgentFunction · 0.85
addToolResultMethod · 0.80
debugMethod · 0.45
getSessionIdMethod · 0.45

Tested by

no test coverage detected