|
| 1 | +/** |
| 2 | + * Add a new message to the conversation history. To be used for complex requests that can't be solved in a single step, as you may forget what happened! |
| 3 | + */ |
| 4 | +export interface AddMessageParams { |
| 5 | + "role": "user" | "assistant" |
| 6 | + "content": string |
| 7 | +} |
| 8 | + |
| 9 | +/** |
| 10 | + * Add a new subgoal for tracking progress. To be used for complex requests that can't be solved in a single step, as you may forget what happened! |
| 11 | + */ |
| 12 | +export interface AddSubgoalParams { |
| 13 | + // A unique identifier for the subgoal. Try to choose the next sequential integer that is not already in use. |
| 14 | + "id": string |
| 15 | + // The objective of the subgoal, concisely and clearly stated. |
| 16 | + "objective": string |
| 17 | + // The status of the subgoal. |
| 18 | + "status": "NOT_STARTED" | "IN_PROGRESS" | "COMPLETE" | "ABORTED" |
| 19 | + // A plan for the subgoal. |
| 20 | + "plan"?: string |
| 21 | + // A log message for the subgoal progress. |
| 22 | + "log"?: string |
| 23 | +} |
| 24 | + |
| 25 | +/** |
| 26 | + * Parameters for browser_logs tool |
| 27 | + */ |
| 28 | +export interface BrowserLogsParams { |
| 29 | + // The type of browser action to perform (e.g., "navigate"). |
| 30 | + "type": string |
| 31 | + // The URL to navigate to. |
| 32 | + "url": string |
| 33 | + // When to consider navigation successful. Defaults to 'load'. |
| 34 | + "waitUntil"?: "load" | "domcontentloaded" | "networkidle0" |
| 35 | +} |
| 36 | + |
| 37 | +/** |
| 38 | + * Search for string patterns in the project's files. This tool uses ripgrep (rg), a fast line-oriented search tool. Use this tool only when read_files is not sufficient to find the files you need. |
| 39 | + */ |
| 40 | +export interface CodeSearchParams { |
| 41 | + // The pattern to search for. |
| 42 | + "pattern": string |
| 43 | + // Optional ripgrep flags to customize the search (e.g., "-i" for case-insensitive, "-t ts" for TypeScript files only, "-A 3" for 3 lines after match, "-B 2" for 2 lines before match, "--type-not test" to exclude test files). |
| 44 | + "flags"?: string |
| 45 | + // Optional working directory to search within, relative to the project root. Defaults to searching the entire project. |
| 46 | + "cwd"?: string |
| 47 | +} |
| 48 | + |
| 49 | +/** |
| 50 | + * Generate a detailed markdown plan for complex tasks. |
| 51 | + */ |
| 52 | +export interface CreatePlanParams { |
| 53 | + // The path including the filename of a markdown file that will be overwritten with the plan. |
| 54 | + "path": string |
| 55 | + // A detailed plan to solve the user's request. |
| 56 | + "plan": string |
| 57 | +} |
| 58 | + |
| 59 | +/** |
| 60 | + * End your turn, regardless of any new tool results that might be coming. This will allow the user to type another prompt. |
| 61 | + */ |
| 62 | +export interface EndTurnParams { |
| 63 | + |
| 64 | +} |
| 65 | + |
| 66 | +/** |
| 67 | + * Find several files related to a brief natural language description of the files or the name of a function or class you are looking for. |
| 68 | + */ |
| 69 | +export interface FindFilesParams { |
| 70 | + // A brief natural language description of the files or the name of a function or class you are looking for. It's also helpful to mention a directory or two to look within. |
| 71 | + "prompt": string |
| 72 | +} |
| 73 | + |
| 74 | +/** |
| 75 | + * Fetch up-to-date documentation for libraries and frameworks using Context7 API. |
| 76 | + */ |
| 77 | +export interface ReadDocsParams { |
| 78 | + // The exact library or framework name (e.g., "Next.js", "MongoDB", "React"). Use the official name as it appears in documentation, not a search query. |
| 79 | + "libraryTitle": string |
| 80 | + // Optional specific topic to focus on (e.g., "routing", "hooks", "authentication") |
| 81 | + "topic"?: string |
| 82 | + // Optional maximum number of tokens to return. Defaults to 10000. Values less than 10000 are automatically increased to 10000. |
| 83 | + "max_tokens"?: number |
| 84 | +} |
| 85 | + |
| 86 | +/** |
| 87 | + * Read the multiple files from disk and return their contents. Use this tool to read as many files as would be helpful to answer the user's request. |
| 88 | + */ |
| 89 | +export interface ReadFilesParams { |
| 90 | + // List of file paths to read. |
| 91 | + "paths": string[] |
| 92 | +} |
| 93 | + |
| 94 | +/** |
| 95 | + * Parameters for run_file_change_hooks tool |
| 96 | + */ |
| 97 | +export interface RunFileChangeHooksParams { |
| 98 | + // List of file paths that were changed and should trigger file change hooks |
| 99 | + "files": string[] |
| 100 | +} |
| 101 | + |
| 102 | +/** |
| 103 | + * Execute a CLI command from the **project root** (different from the user's cwd). |
| 104 | + */ |
| 105 | +export interface RunTerminalCommandParams { |
| 106 | + // CLI command valid for user's OS. |
| 107 | + "command": string |
| 108 | + // Either SYNC (waits, returns output) or BACKGROUND (runs in background). Default SYNC |
| 109 | + "process_type": "SYNC" | "BACKGROUND" |
| 110 | + // The working directory to run the command in. Default is the project root. |
| 111 | + "cwd"?: string |
| 112 | + // Set to -1 for no timeout. Does not apply for BACKGROUND commands. Default 30 |
| 113 | + "timeout_seconds": number |
| 114 | +} |
| 115 | + |
| 116 | +/** |
| 117 | + * Send a message to another agent (parent or child) for communication and data exchange. |
| 118 | + */ |
| 119 | +export interface SendAgentMessageParams { |
| 120 | + // ID of the target agent to send message to. Use "PARENT_ID" to send to parent agent. |
| 121 | + "target_agent_id": string |
| 122 | + // Message prompt to send to the target agent |
| 123 | + "prompt": string |
| 124 | + // Optional parameters object to send with the message |
| 125 | + "params"?: Record<string, any> |
| 126 | +} |
| 127 | + |
| 128 | +/** |
| 129 | + * Set the conversation history to the provided messages. |
| 130 | + */ |
| 131 | +export interface SetMessagesParams { |
| 132 | + "messages": { |
| 133 | + "role": "user" | "assistant" |
| 134 | + "content": string |
| 135 | +}[] |
| 136 | +} |
| 137 | + |
| 138 | +/** |
| 139 | + * JSON object to set as the agent output. This completely replaces any previous output. If the agent was spawned, this value will be passed back to its parent. If the agent has an outputSchema defined, the output will be validated against it. |
| 140 | + */ |
| 141 | +export interface SetOutputParams { |
| 142 | + |
| 143 | +} |
| 144 | + |
| 145 | +/** |
| 146 | + * Spawn multiple agents and send a prompt to each of them. |
| 147 | + */ |
| 148 | +export interface SpawnAgentsParams { |
| 149 | + "agents": { |
| 150 | + // Agent to spawn |
| 151 | + "agent_type": string |
| 152 | + // Prompt to send to the agent |
| 153 | + "prompt"?: string |
| 154 | + // Parameters object for the agent (if any) |
| 155 | + "params"?: Record<string, any> |
| 156 | +}[] |
| 157 | +} |
| 158 | + |
| 159 | +/** |
| 160 | + * Parameters for spawn_agents_async tool |
| 161 | + */ |
| 162 | +export interface SpawnAgentsAsyncParams { |
| 163 | + "agents": { |
| 164 | + // Agent to spawn |
| 165 | + "agent_type": string |
| 166 | + // Prompt to send to the agent |
| 167 | + "prompt"?: string |
| 168 | + // Parameters object for the agent (if any) |
| 169 | + "params"?: Record<string, any> |
| 170 | +}[] |
| 171 | +} |
| 172 | + |
| 173 | +/** |
| 174 | + * Replace strings in a file with new strings. |
| 175 | + */ |
| 176 | +export interface StrReplaceParams { |
| 177 | + // The path to the file to edit. |
| 178 | + "path": string |
| 179 | + // Array of replacements to make. |
| 180 | + "replacements": { |
| 181 | + // The string to replace. This must be an *exact match* of the string you want to replace, including whitespace and punctuation. |
| 182 | + "old": string |
| 183 | + // The string to replace the corresponding old string with. Can be empty to delete. |
| 184 | + "new": string |
| 185 | +}[] |
| 186 | +} |
| 187 | + |
| 188 | +/** |
| 189 | + * Deeply consider complex tasks by brainstorming approaches and tradeoffs step-by-step. |
| 190 | + */ |
| 191 | +export interface ThinkDeeplyParams { |
| 192 | + // Detailed step-by-step analysis. Initially keep each step concise (max ~5-7 words per step). |
| 193 | + "thought": string |
| 194 | +} |
| 195 | + |
| 196 | +/** |
| 197 | + * Update a subgoal in the context given the id, and optionally the status or plan, or a new log to append. Feel free to update any combination of the status, plan, or log in one invocation. |
| 198 | + */ |
| 199 | +export interface UpdateSubgoalParams { |
| 200 | + // The id of the subgoal to update. |
| 201 | + "id": string |
| 202 | + // Change the status of the subgoal. |
| 203 | + "status"?: "NOT_STARTED" | "IN_PROGRESS" | "COMPLETE" | "ABORTED" |
| 204 | + // Change the plan for the subgoal. |
| 205 | + "plan"?: string |
| 206 | + // Add a log message to the subgoal. This will create a new log entry and append it to the existing logs. Use this to record your progress and any new information you learned as you go. |
| 207 | + "log"?: string |
| 208 | +} |
| 209 | + |
| 210 | +/** |
| 211 | + * Search the web for current information using Linkup API. |
| 212 | + */ |
| 213 | +export interface WebSearchParams { |
| 214 | + // The search query to find relevant web content |
| 215 | + "query": string |
| 216 | + // Search depth - 'standard' for quick results, 'deep' for more comprehensive search. Default is 'standard'. |
| 217 | + "depth": "standard" | "deep" |
| 218 | +} |
| 219 | + |
| 220 | +/** |
| 221 | + * Create or edit a file with the given content. |
| 222 | + */ |
| 223 | +export interface WriteFileParams { |
| 224 | + // Path to the file relative to the **project root** |
| 225 | + "path": string |
| 226 | + // What the change is intended to do in only one sentence. |
| 227 | + "instructions": string |
| 228 | + // Edit snippet to apply to the file. |
| 229 | + "content": string |
| 230 | +} |
| 231 | + |
| 232 | +/** |
| 233 | + * Union type of all available tool names |
| 234 | + */ |
| 235 | +export type ToolName = 'add_message' | 'add_subgoal' | 'browser_logs' | 'code_search' | 'create_plan' | 'end_turn' | 'find_files' | 'read_docs' | 'read_files' | 'run_file_change_hooks' | 'run_terminal_command' | 'send_agent_message' | 'set_messages' | 'set_output' | 'spawn_agents' | 'spawn_agents_async' | 'str_replace' | 'think_deeply' | 'update_subgoal' | 'web_search' | 'write_file' |
| 236 | + |
| 237 | +/** |
| 238 | + * Map of tool names to their parameter types |
| 239 | + */ |
| 240 | +export interface ToolParamsMap { |
| 241 | + 'add_message': AddMessageParams |
| 242 | + 'add_subgoal': AddSubgoalParams |
| 243 | + 'browser_logs': BrowserLogsParams |
| 244 | + 'code_search': CodeSearchParams |
| 245 | + 'create_plan': CreatePlanParams |
| 246 | + 'end_turn': EndTurnParams |
| 247 | + 'find_files': FindFilesParams |
| 248 | + 'read_docs': ReadDocsParams |
| 249 | + 'read_files': ReadFilesParams |
| 250 | + 'run_file_change_hooks': RunFileChangeHooksParams |
| 251 | + 'run_terminal_command': RunTerminalCommandParams |
| 252 | + 'send_agent_message': SendAgentMessageParams |
| 253 | + 'set_messages': SetMessagesParams |
| 254 | + 'set_output': SetOutputParams |
| 255 | + 'spawn_agents': SpawnAgentsParams |
| 256 | + 'spawn_agents_async': SpawnAgentsAsyncParams |
| 257 | + 'str_replace': StrReplaceParams |
| 258 | + 'think_deeply': ThinkDeeplyParams |
| 259 | + 'update_subgoal': UpdateSubgoalParams |
| 260 | + 'web_search': WebSearchParams |
| 261 | + 'write_file': WriteFileParams |
| 262 | +} |
| 263 | + |
| 264 | +/** |
| 265 | + * Get parameters type for a specific tool |
| 266 | + */ |
| 267 | +export type GetToolParams<T extends ToolName> = ToolParamsMap[T] |
0 commit comments