cursor_agent
Execute prompts with Cursor's AI agent to generate, review, or debug code; select model and mode, and get changed files plus model used.
Instructions
Execute a prompt using Cursor's AI agent with any model id the installed cursor-agent accepts (Composer, Claude, GPT, Gemini, Grok families on your plan; run cursor_models for ids). Modes: 'agent' (tools, terminal, search), 'plan' (design-focused), 'ask' (read-only). In headless mode cursor-agent only PROPOSES file changes unless the server operator set CURSOR_ALLOW_YOLO=true (then --force applies them; CURSOR_SANDBOX=enabled confines them). The result lists the files changed and the model used; a client that sends a progress token gets a progress notification per tool call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Agent mode. 'agent' = full capabilities (file edit, terminal, search). 'plan' = design-focused, asks clarifying questions. 'ask' = read-only exploration. Default: agent. | |
| model | No | AI model id as cursor-agent accepts it, passed through to --model (any id cursor_models lists; e.g. a Composer, Claude, GPT, Gemini or Grok id on your plan). Default: auto (Cursor picks the model). Was a closed list of old ids before 1.1.0. | |
| prompt | Yes | The prompt or task for the Cursor agent. Supports natural language instructions for code generation, review, debugging, and more. | |
| workspace | No | Working directory for the agent. Affects file search scope and project context. Default: server's current working directory. | |
| timeout_seconds | No | Maximum execution time in seconds (10-3600). Default: 600 (10 minutes). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | The model cursor-agent reported at start (its display name), if it did | |
| result | Yes | The agent's final answer; without a result event, its last message, else empty (what stdout held is in noise_sample, never here) | |
| status | Yes | cursor-agent's result subtype: success, error, …; no-result-event when the run ended without one | |
| stderr | Yes | ||
| is_error | Yes | ||
| exit_code | Yes | cursor-agent's exit code (null when it was killed) | |
| request_id | Yes | ||
| session_id | Yes | The session to resume with cursor_reply | |
| tool_calls | Yes | Completed tool calls the agent made | |
| duration_ms | Yes | ||
| noise_lines | Yes | stdout lines that were not stream-json events (counted, never dropped) | |
| noise_sample | Yes | The first few of those lines, verbatim (500 characters each at most) | |
| files_changed | Yes | Paths of file-tool write/edit/delete calls that reported success, in order, each once. Shell commands are not inspected: a file written by a shell tool is not listed. | |
| files_proposed | Yes | Paths of file-tool write/edit/delete calls that did not report success (proposed without --force, refused, failed), each once |