Add MCP tool prompt support to system prompts

- Add tool_prompt to CoderPrompts class
- Modify fmt_system_prompt to include tool prompt when MCP tools are available
- This enables better handling of tool-based interactions when using MCP servers
This commit is contained in:
Quinlan Jager 2025-05-06 11:40:28 -07:00
parent 2696ce0414
commit de35fb6a2c
2 changed files with 14 additions and 0 deletions

View file

@ -1155,6 +1155,9 @@ class Coder:
def fmt_system_prompt(self, prompt):
final_reminders = []
if self.mcp_tools and len(self.mcp_tools) > 0:
final_reminders.append(self.gpt_prompts.tool_prompt)
if self.main_model.lazy:
final_reminders.append(self.gpt_prompts.lazy_prompt)
if self.main_model.overeager:

View file

@ -56,5 +56,16 @@ Do not edit these files!
no_shell_cmd_prompt = ""
no_shell_cmd_reminder = ""
tool_prompt = """Answer the user's request using the relevant tool(s), if they are available.
Check that all the required parameters for each tool call are provided or can reasonably be
inferred from context. IF there are no relevant tools or there are missing values for required
parameters, ask the user to supply these values; otherwise proceed with the tool calls. If the
user provides a specific value for a parameter (for example provided in quotes), make sure to
use that value EXACTLY.
DO NOT make up values for or ask about optional parameters. Carefully analyze descriptive terms in
the request as they may indicate required parameter values that should be included even if not
explicitly quoted.
"""
rename_with_shell = ""
go_ahead_tip = ""