(cwd: string, mcpHub?: McpHub, allowedMcpServers?: string[])
| 17 | * the hub's servers are filtered to this set before determining MCP availability. |
| 18 | */ |
| 19 | export function getCapabilitiesSection(cwd: string, mcpHub?: McpHub, allowedMcpServers?: string[]): string { |
| 20 | // Determine whether any MCP server is actually available to the current mode. |
| 21 | // Filtering the hub's servers by the allowlist (when provided) keeps the capability |
| 22 | // text consistent with the tools that are exposed for the mode. |
| 23 | let hasMcpServers = false |
| 24 | if (mcpHub) { |
| 25 | let servers = mcpHub.getServers() |
| 26 | if (allowedMcpServers) { |
| 27 | const allowSet = new Set(allowedMcpServers) |
| 28 | servers = servers.filter((server) => allowSet.has(server.name)) |
| 29 | } |
| 30 | hasMcpServers = servers.length > 0 |
| 31 | } |
| 32 | |
| 33 | return `==== |
| 34 | |
| 35 | CAPABILITIES |
| 36 | |
| 37 | - You have access to tools that let you execute CLI commands on the user's computer, list files, view source code definitions, regex search, read and write files, and ask follow-up questions. These tools help you effectively accomplish a wide range of tasks, such as writing code, making edits or improvements to existing files, understanding the current state of a project, performing system operations, and much more. |
| 38 | - When the user initially gives you a task, a recursive list of all filepaths in the current workspace directory ('${cwd}') will be included in environment_details. This provides an overview of the project's file structure, offering key insights into the project from directory/file names (how developers conceptualize and organize their code) and file extensions (the language used). This can also guide decision-making on which files to explore further. If you need to further explore directories such as outside the current workspace directory, you can use the list_files tool. If you pass 'true' for the recursive parameter, it will list files recursively. Otherwise, it will list files at the top level, which is better suited for generic directories where you don't necessarily need the nested structure, like the Desktop. |
| 39 | - You can use the execute_command tool to run commands on the user's computer whenever you feel it can help accomplish the user's task. When you need to execute a CLI command, you must provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, since they are more flexible and easier to run. Interactive and long-running commands are allowed, since the commands are run in the user's VSCode terminal. The user may keep commands running in the background and you will be kept updated on their status along the way. Each command you execute is run in a new terminal instance.${ |
| 40 | hasMcpServers |
| 41 | ? ` |
| 42 | - You have access to MCP servers that may provide additional tools and resources. Each server may provide different capabilities that you can use to accomplish tasks more effectively. |
| 43 | ` |
| 44 | : "" |
| 45 | }` |
| 46 | } |
no test coverage detected