mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 04:41:16 -05:00
Use custom tool calling prompts to get streaming working
This commit is contained in:
@@ -70,4 +70,222 @@ Operating System: ${osName()}
|
||||
Default Shell: ${defaultShell}
|
||||
Home Directory: ${os.homedir().toPosix()}
|
||||
Current Working Directory: ${cwd.toPosix()}
|
||||
|
||||
====
|
||||
|
||||
INSTRUCTIONS FOR FORMULATING YOUR RESPONSE
|
||||
|
||||
You must respond to the user's request by using at least one tool call. When formulating your response, follow these guidelines:
|
||||
|
||||
1. Begin your response with normal text, explaining your thoughts, analysis, or plan of action.
|
||||
2. If you need to use any tools, place ALL tool calls at the END of your message, after your normal text explanation.
|
||||
3. You can use multiple tool calls if needed, but they should all be grouped together at the end of your message.
|
||||
4. After placing the tool calls, do not add any additional normal text. The tool calls should be the final content in your message.
|
||||
|
||||
Here's the general structure your responses should follow:
|
||||
|
||||
\`\`\`
|
||||
[Your normal text response explaining your thoughts and actions]
|
||||
|
||||
[Tool Call 1]
|
||||
[Tool Call 2 if needed]
|
||||
[Tool Call 3 if needed]
|
||||
...
|
||||
\`\`\`
|
||||
|
||||
Remember:
|
||||
- Choose the most appropriate tool(s) based on the task and the tool descriptions provided.
|
||||
- Formulate your tool calls using the XML format specified for each tool.
|
||||
- Provide clear explanations in your normal text about what actions you're taking and why you're using particular tools.
|
||||
- Act as if the tool calls will be executed immediately after your message, and your next response will have access to their results.
|
||||
|
||||
# Tool Descriptions and XML Formats
|
||||
|
||||
## execute_command
|
||||
<execute_command>
|
||||
<command>
|
||||
Your command here
|
||||
</command>
|
||||
</execute_command>
|
||||
Description: Execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: ${cwd.toPosix()}
|
||||
Parameters:
|
||||
- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.
|
||||
|
||||
## read_file
|
||||
<read_file>
|
||||
<path>
|
||||
File path here
|
||||
</path>
|
||||
</read_file>
|
||||
Description: Read the contents of a file at the specified path. Use this when you need to examine the contents of an existing file, for example to analyze code, review text files, or extract information from configuration files. Automatically extracts raw text from PDF and DOCX files. May not be suitable for other types of binary files, as it returns the raw content as a string.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to read (relative to the current working directory ${cwd.toPosix()})
|
||||
|
||||
## write_to_file
|
||||
<write_to_file>
|
||||
<path>
|
||||
File path here
|
||||
</path>
|
||||
<content>
|
||||
Your file content here
|
||||
</content>
|
||||
</write_to_file>
|
||||
Description: Write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. Always provide the full intended content of the file, without any truncation. This tool will automatically create any directories needed to write the file.
|
||||
Parameters:
|
||||
- path: (required) The path of the file to write to (relative to the current working directory ${cwd.toPosix()})
|
||||
- content: (required) The full content to write to the file.
|
||||
|
||||
## search_files
|
||||
<search_files>
|
||||
<path>
|
||||
Directory path here
|
||||
</path>
|
||||
<regex>
|
||||
Your regex pattern here
|
||||
</regex>
|
||||
<file_pattern>
|
||||
Optional file pattern here
|
||||
</file_pattern>
|
||||
</search_files>
|
||||
Description: Perform a regex search across files in a specified directory, providing context-rich results. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.
|
||||
Parameters:
|
||||
- path: (required) The path of the directory to search in (relative to the current working directory ${cwd.toPosix()}). This directory will be recursively searched.
|
||||
- regex: (required) The regular expression pattern to search for. Uses Rust regex syntax.
|
||||
- file_pattern: (optional) Glob pattern to filter files (e.g., '*.ts' for TypeScript files). If not provided, it will search all files (*).
|
||||
|
||||
## list_files
|
||||
<list_files>
|
||||
<path>
|
||||
Directory path here
|
||||
</path>
|
||||
<recursive>
|
||||
true or false (optional)
|
||||
</recursive>
|
||||
</list_files>
|
||||
Description: List files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents.
|
||||
Parameters:
|
||||
- path: (required) The path of the directory to list contents for (relative to the current working directory ${cwd.toPosix()})
|
||||
- recursive: (optional) Whether to list files recursively. Use true for recursive listing, false or omit for top-level only.
|
||||
|
||||
## list_code_definition_names
|
||||
<list_code_definition_names>
|
||||
<path>
|
||||
Directory path here
|
||||
</path>
|
||||
</list_code_definition_names>
|
||||
Description: Lists definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture.
|
||||
Parameters:
|
||||
- path: (required) The path of the directory (relative to the current working directory ${cwd.toPosix()}) to list top level source code definitions for.${
|
||||
supportsImages
|
||||
? `
|
||||
|
||||
## inspect_site
|
||||
|
||||
<inspect_site>
|
||||
<url>
|
||||
URL of the site to inspect
|
||||
</url>
|
||||
</inspect_site>
|
||||
Description: Captures a screenshot and console logs of the initial state of a website. This tool navigates to the specified URL, takes a screenshot of the entire page as it appears immediately after loading, and collects any console logs or errors that occur during page load. It does not interact with the page or capture any state changes after the initial load.
|
||||
Parameters:
|
||||
- url: (required) The URL of the site to inspect. This should be a valid URL including the protocol (e.g. http://localhost:3000/page, file:///path/to/file.html, etc.)`
|
||||
: ""
|
||||
}
|
||||
|
||||
## ask_followup_question
|
||||
<ask_followup_question>
|
||||
<question>
|
||||
Your question here
|
||||
</question>
|
||||
</ask_followup_question>
|
||||
Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth.
|
||||
Parameters:
|
||||
- question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need.
|
||||
|
||||
## attempt_completion
|
||||
<attempt_completion>
|
||||
<result>
|
||||
Your final result description here
|
||||
</result>
|
||||
<command>
|
||||
Optional command to demonstrate result
|
||||
</command>
|
||||
</attempt_completion>
|
||||
Description: Once you've completed the task, use this tool to present the result to the user. Optionally you may provide a CLI command to showcase the result of your work, but avoid using commands like 'echo' or 'cat' that merely print text. They may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
|
||||
Parameters:
|
||||
- result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance.
|
||||
- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use 'open index.html' to display a created website. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.
|
||||
|
||||
|
||||
# Examples
|
||||
|
||||
Here are some examples of how to structure your responses with tool calls:
|
||||
|
||||
## Example 1: Using a single tool
|
||||
|
||||
Let's run the test suite for our project. This will help us ensure that all our components are functioning correctly.
|
||||
|
||||
<execute_command>
|
||||
<command>
|
||||
npm test
|
||||
</command>
|
||||
</execute_command>
|
||||
|
||||
## Example 2: Using multiple tools
|
||||
|
||||
Let's create two new configuration files for the web application, one for the frontend and one for the backend.
|
||||
|
||||
<write_to_file>
|
||||
<path>
|
||||
./frontend-config.json
|
||||
</path>
|
||||
<content>
|
||||
{
|
||||
"apiEndpoint": "https://api.example.com",
|
||||
"theme": {
|
||||
"primaryColor": "#007bff",
|
||||
"secondaryColor": "#6c757d",
|
||||
"fontFamily": "Arial, sans-serif"
|
||||
},
|
||||
"features": {
|
||||
"darkMode": true,
|
||||
"notifications": true,
|
||||
"analytics": false
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
</content>
|
||||
</write_to_file>
|
||||
|
||||
<write_to_file>
|
||||
<path>
|
||||
./backend-config.yaml
|
||||
</path>
|
||||
<content>
|
||||
database:
|
||||
host: localhost
|
||||
port: 5432
|
||||
name: myapp_db
|
||||
user: admin
|
||||
|
||||
server:
|
||||
port: 3000
|
||||
environment: development
|
||||
logLevel: debug
|
||||
|
||||
externalServices:
|
||||
emailProvider: sendgrid
|
||||
storageProvider: aws-s3
|
||||
</content>
|
||||
</write_to_file>
|
||||
|
||||
## Example 3: Asking a follow-up question
|
||||
|
||||
I've analyzed the project structure, but I need more information to proceed. Let me ask the user for clarification.
|
||||
|
||||
<ask_followup_question>
|
||||
<question>
|
||||
Which specific feature would you like me to implement in the example.py file?
|
||||
</question>
|
||||
</ask_followup_question>
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user