Skip to content

Commit b8549f1

Browse files
authored
Auto-approval logic for fetch_instructions (#1976)
1 parent 6258493 commit b8549f1

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,9 +3358,7 @@ When a server is connected, you can use the server's tools via the \`use_mcp_too
33583358
(No MCP servers currently connected)
33593359
## Creating an MCP Server
33603360

3361-
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`.
3362-
3363-
You can obtain detailed instructions on this topic using the fetch_instructions tool, like this:
3361+
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. If they do, you should obtain detailed instructions on this topic using the fetch_instructions tool, like this:
33643362
<fetch_instructions>
33653363
<task>create_mcp_server</task>
33663364
</fetch_instructions>
@@ -6671,9 +6669,7 @@ When a server is connected, you can use the server's tools via the \`use_mcp_too
66716669
(No MCP servers currently connected)
66726670
## Creating an MCP Server
66736671

6674-
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`.
6675-
6676-
You can obtain detailed instructions on this topic using the fetch_instructions tool, like this:
6672+
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. If they do, you should obtain detailed instructions on this topic using the fetch_instructions tool, like this:
66776673
<fetch_instructions>
66786674
<task>create_mcp_server</task>
66796675
</fetch_instructions>

src/core/prompts/sections/mcp-servers.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ ${connectedServers}`
6969
`
7070
## Creating an MCP Server
7171
72-
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. You have the ability to create an MCP server and add it to a configuration file that will then expose the tools and resources for you to use with \`use_mcp_tool\` and \`access_mcp_resource\`.
73-
74-
You can obtain detailed instructions on this topic using the fetch_instructions tool, like this:
72+
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. If they do, you should obtain detailed instructions on this topic using the fetch_instructions tool, like this:
7573
<fetch_instructions>
7674
<task>create_mcp_server</task>
7775
</fetch_instructions>`

src/core/prompts/sections/modes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ${allModes.map((mode: ModeConfig) => ` * "${mode.name}" mode (${mode.slug}) - $
2424
// Only include custom modes documentation if the feature is enabled
2525
if (shouldEnableCustomModeCreation) {
2626
modesContent += `
27-
If the user asks you to create or edit a new mode for this project, you can get instructions using the fetch_instructions tool, like this:
27+
If the user asks you to create or edit a new mode for this project, you should read the instructions by using the fetch_instructions tool, like this:
2828
<fetch_instructions>
2929
<task>create_mode</task>
3030
</fetch_instructions>

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,15 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
676676
return false
677677
}
678678

679+
if (tool?.tool === "fetchInstructions") {
680+
if (tool.content === "create_mode") {
681+
return alwaysAllowModeSwitch
682+
}
683+
if (tool.content === "create_mcp_server") {
684+
return alwaysAllowMcp
685+
}
686+
}
687+
679688
if (tool?.tool === "switchMode") {
680689
return alwaysAllowModeSwitch
681690
}

0 commit comments

Comments
 (0)