src / agents / tools / index.ts
import type { Tool } from "@lmstudio/sdk";
import { createRunCommandTool } from "./command";
import type { AgentToolContext } from "./context";
import { createEditFilesTool } from "./edit";
import { createFinishRunTool } from "./finish";
import {
createInspectTreeTool,
createReadFileTool,
createSearchWorkspaceTool,
} from "./inspect";
import { createRecordNoteTool } from "./notes";
import { createSetPlanTool } from "./plan";
import { createTaskBoardTool } from "./tasks";
import {
createFetchSourceTool,
createRecordResearchNoteTool,
createWebSearchTool,
} from "./web";
export type { AgentToolContext } from "./context";
/**
* The sub-agent tool set for one run. Every tool is built regardless of the run
* shape and the run shape only decides which ones are handed to the model, so
* the conditional list below is the single place that answers "why can't the
* sub-agent see tool X".
*/
export function buildAgentTools(ctx: AgentToolContext): Tool[] {
const { state } = ctx;
const setPlan = createSetPlanTool(ctx);
const tree = createInspectTreeTool(ctx);
const readFileTool = createReadFileTool(ctx);
const search = createSearchWorkspaceTool(ctx);
const edit = createEditFilesTool(ctx);
const runCommand = createRunCommandTool(ctx);
const webSearch = createWebSearchTool(ctx);
const fetchSource = createFetchSourceTool(ctx);
const researchNote = createRecordResearchNoteTool(ctx);
const taskBoard = createTaskBoardTool(ctx);
const note = createRecordNoteTool(ctx);
const finish = createFinishRunTool(ctx);
return [
setPlan,
tree,
readFileTool,
search,
...(state.mode === "research" ? [] : [edit]),
...(state.allowCommands ? [runCommand] : []),
...(state.allowWeb ? [webSearch, fetchSource] : []),
...(state.allowWeb || state.researchProjectId ? [researchNote] : []),
...(state.taskBoardId ? [taskBoard] : []),
note,
finish,
];
}
src / agents / tools / index.ts
import type { Tool } from "@lmstudio/sdk";
import { createRunCommandTool } from "./command";
import type { AgentToolContext } from "./context";
import { createEditFilesTool } from "./edit";
import { createFinishRunTool } from "./finish";
import {
createInspectTreeTool,
createReadFileTool,
createSearchWorkspaceTool,
} from "./inspect";
import { createRecordNoteTool } from "./notes";
import { createSetPlanTool } from "./plan";
import { createTaskBoardTool } from "./tasks";
import {
createFetchSourceTool,
createRecordResearchNoteTool,
createWebSearchTool,
} from "./web";
export type { AgentToolContext } from "./context";
/**
* The sub-agent tool set for one run. Every tool is built regardless of the run
* shape and the run shape only decides which ones are handed to the model, so
* the conditional list below is the single place that answers "why can't the
* sub-agent see tool X".
*/
export function buildAgentTools(ctx: AgentToolContext): Tool[] {
const { state } = ctx;
const setPlan = createSetPlanTool(ctx);
const tree = createInspectTreeTool(ctx);
const readFileTool = createReadFileTool(ctx);
const search = createSearchWorkspaceTool(ctx);
const edit = createEditFilesTool(ctx);
const runCommand = createRunCommandTool(ctx);
const webSearch = createWebSearchTool(ctx);
const fetchSource = createFetchSourceTool(ctx);
const researchNote = createRecordResearchNoteTool(ctx);
const taskBoard = createTaskBoardTool(ctx);
const note = createRecordNoteTool(ctx);
const finish = createFinishRunTool(ctx);
return [
setPlan,
tree,
readFileTool,
search,
...(state.mode === "research" ? [] : [edit]),
...(state.allowCommands ? [runCommand] : []),
...(state.allowWeb ? [webSearch, fetchSource] : []),
...(state.allowWeb || state.researchProjectId ? [researchNote] : []),
...(state.taskBoardId ? [taskBoard] : []),
note,
finish,
];
}