/** * Default AgentTool Definitions * * Factory functions for creating the default tools. */ import { type AgentTool, type ShellKind } from "@cline/shared"; import { type ApplyPatchInput, type AskQuestionInput, type EditFileInput, type FetchWebContentInput, type ReadFilesInput, type SearchCodebaseInput, type SkillsInput, type SubmitInput } from "./schemas"; import type { ApplyPatchExecutor, AskQuestionExecutor, CreateDefaultToolsOptions, DefaultToolsConfig, EditorExecutor, FileReadExecutor, SearchExecutor, ShellExecutor, SkillsExecutorWithMetadata, ToolOperationResult, VerifySubmitExecutor, WebFetchExecutor } from "./types"; /** * Create the read_files tool * * Reads the content of one or more files from the filesystem. */ export declare function createReadFilesTool(executor: FileReadExecutor, config?: Pick): AgentTool; /** * Create the search_codebase tool * * Performs regex pattern searches across the codebase. */ export declare function createSearchTool(executor: SearchExecutor, config?: Pick): AgentTool; /** * Build the run_commands tool description for the shell that will actually * execute the commands. The shell kind decides the syntax guidance (quoting, * sequencing, heredocs), and isWindows adds environment context for POSIX * shells running on a Windows host (e.g. Git Bash). */ export declare function buildRunCommandsDescription(shellKind: ShellKind, isWindows: boolean): string; /** * Create the run_commands shell tool for the current platform. * * This preserves the SDK's platform-specific prompting/schema choices while * exposing a single generic shell-tool factory for host integrations. Pass * config.shell (matching the executor's shell) so the syntax guidance in the * tool description matches the shell that actually runs the commands. * * config.shell may be a provider function instead of a string. The runtime * reads `description` when building each model request, so a provider is * consulted at that boundary: a shell change made while the model is * generating does not affect the request in flight, and the next request * names the new shell. The provider must return the shell the executor will * use for tool calls issued by that next request. */ export declare function createShellTool(executor: ShellExecutor, config?: Pick & { shell?: string | (() => string); }): AgentTool; /** * Create the fetch_web_content tool * * Fetches content from URLs and analyzes them using provided prompts. */ export declare function createWebFetchTool(executor: WebFetchExecutor, config?: Pick): AgentTool; /** * Create the apply_patch tool * * Applies the canonical apply_patch format to one or more files. */ export declare function createApplyPatchTool(executor: ApplyPatchExecutor, config?: Pick): AgentTool; /** * Create the editor tool * * Supports controlled filesystem edits with create, replace, and insert commands. */ export declare function createEditorTool(executor: EditorExecutor, config?: Pick): AgentTool; /** * Create the skills tool * * Invokes a configured skill by name and optional arguments. */ export declare function createSkillsTool(executor: SkillsExecutorWithMetadata, config?: Pick): AgentTool; /** * Create the ask_question tool * * Asks the user a single clarifying question with 2-5 selectable options. */ export declare function createAskQuestionTool(executor: AskQuestionExecutor): AgentTool; export declare function createSubmitAndExitTool(executor: VerifySubmitExecutor, config?: Pick): AgentTool; /** * Create a set of default tools for an agent * * This function creates the default tools based on the provided configuration * and executors. Only tools that are enabled AND have an executor provided * will be included in the returned array. * * @example * ```typescript * import { Agent, createDefaultTools } from "@cline/core" * import * as fs from "fs/promises" * import { exec } from "child_process" * * const tools = createDefaultTools({ * executors: { * readFile: async ({ path }) => fs.readFile(path, "utf-8"), * bash: async (cmd, cwd) => { * return new Promise((resolve, reject) => { * exec(cmd, { cwd }, (err, stdout, stderr) => { * if (err) reject(new Error(stderr || err.message)) * else resolve(stdout) * }) * }) * }, * }, * enableReadFiles: true, * enableBash: true, * enableSearch: false, // Disabled * enableWebFetch: false, // Disabled * cwd: "/path/to/project", * }) * * const agent = new Agent({ * // ... provider config * tools, * }) * ``` */ export declare function createDefaultTools(options: CreateDefaultToolsOptions): AgentTool[];