You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#4900: MCP Tool reminders enforce the wrong syntax
- Modified formatResponse.noToolsUsed() and formatResponse.missingToolParameterError() to accept optional hasMcpTools parameter
- Added getToolUseInstructionsReminder() function that provides correct syntax based on tool type
- When MCP tools are available, shows proper use_mcp_tool format instead of generic XML format
- Added hasMcpToolsAvailable() method to Task class to detect when MCP servers with tools are connected
- Updated all call sites to pass MCP tool availability information
- Maintains backward compatibility with legacy toolUseInstructionsReminder constant
This prevents the infinite loop where AI tries wrong MCP syntax and gets corrected with wrong format.
`Access to ${path} is blocked by the .rooignore file settings. You must try to continue in the task without using this file, or ask the user to update the .rooignore file.`,
20
20
21
-
noToolsUsed: ()=>
21
+
noToolsUsed: (hasMcpTools?: boolean)=>
22
22
`[ERROR] You did not use a tool in your previous response! Please retry with a tool use.
23
23
24
-
${toolUseInstructionsReminder}
24
+
${getToolUseInstructionsReminder(hasMcpTools)}
25
25
26
26
# Next Steps
27
27
28
-
If you have completed the user's task, use the attempt_completion tool.
29
-
If you require additional information from the user, use the ask_followup_question tool.
30
-
Otherwise, if you have not completed the task and do not need additional information, then proceed with the next step of the task.
28
+
If you have completed the user's task, use the attempt_completion tool.
29
+
If you require additional information from the user, use the ask_followup_question tool.
30
+
Otherwise, if you have not completed the task and do not need additional information, then proceed with the next step of the task.
31
31
(This is an automated message, so do not respond to it conversationally.)`,
32
32
33
33
tooManyMistakes: (feedback?: string)=>
34
34
`You seem to be having trouble proceeding. The user has provided the following feedback to help guide you:\n<feedback>\n${feedback}\n</feedback>`,
35
35
36
-
missingToolParameterError: (paramName: string)=>
37
-
`Missing value for required parameter '${paramName}'. Please retry with complete response.\n\n${toolUseInstructionsReminder}`,
consttruncationMessage=`Note: Your response may have been truncated because it exceeded your output limit. You wrote ${actualLineCount} lines of content, but the line_count parameter was either missing or not included in your response.`
@@ -66,7 +66,7 @@ Otherwise, if you have not completed the task and do not need additional informa
MCP tools must be called using the use_mcp_tool format:
198
+
199
+
<use_mcp_tool>
200
+
<server_name>server name here</server_name>
201
+
<tool_name>tool name here</tool_name>
202
+
<arguments>
203
+
{
204
+
"param1": "value1",
205
+
"param2": "value2"
206
+
}
207
+
</arguments>
208
+
</use_mcp_tool>
209
+
210
+
For regular tools, use the standard XML format:
211
+
212
+
<actual_tool_name>
213
+
<parameter1_name>value1</parameter1_name>
214
+
<parameter2_name>value2</parameter2_name>
215
+
...
216
+
</actual_tool_name>
217
+
218
+
Always use the correct format for the type of tool you are calling.`
219
+
}else{
220
+
return`# Reminder: Instructions for Tool Use
194
221
195
222
Tool uses are formatted using XML-style tags. The tool name itself becomes the XML tag name. Each parameter is enclosed within its own set of tags. Here's the structure:
196
223
@@ -209,3 +236,8 @@ I have completed the task...
209
236
</attempt_completion>
210
237
211
238
Always use the actual tool name as the XML tag name for proper parsing and execution.`
0 commit comments