Refine Prompt
refine_promptImprove prompts for AI agents by selecting or creating optimized versions based on agent type, language, and project context. Use scoping options to focus the agent on relevant files, directories, and priorities.
Instructions
Refine a prompt before sending to an agent.
Given an original prompt and context, either selects an existing refined prompt or creates a new one optimized for the agent type and language.
Scoping Options (Optional but Recommended):
To improve focus and reduce context overload, include in the context dict:
target_dirs: List of directories the agent should focus on (e.g., ["src/", "tests/"])target_files: Specific files to modify (e.g., ["src/main.py", "src/config.py"])exclude_paths: Paths to ignore (e.g., [".venv/", "node_modules/"])scope: High-level scope description (e.g., "backend API layer only")focus: Priority aspects (e.g., ["performance", "security", "error-handling"])
Note: A project_id is required. If not provided, the response will include a list of existing projects or instructions to create one. The agent should:
Call list_projects to see available projects, or
Call create_project to create a new one, then
Resubmit the refine_prompt request with the project_id
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes | Refinement request with prompt details |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| source | Yes | ||
| prompt_key | Yes | ||
| usage_count | No | ||
| average_score | No | ||
| refined_prompt | Yes | ||
| confidence_score | No | ||
| similar_prompts_found | No |