watch_process
Spawn and monitor local processes to capture stdout, stderr, and exit codes for real-time feedback in development workflows.
Instructions
Spawn and monitor a local process, capturing stdout/stderr and exit code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Command to run | |
| args | No | Command arguments | |
| cwd | No | Working directory (optional) | |
| action_id | No | Link events to an agent action |
Implementation Reference
- src/server.ts:285-322 (handler)The handler function 'handleWatchProcess' that executes the tool logic for 'watch_process'.
private async handleWatchProcess(args: Record<string, unknown>) { const schema = z.object({ command: z.string(), args: z.array(z.string()).default([]), cwd: z.string().optional(), action_id: z.string().optional(), }); const parsed = schema.parse(args); const id = uuidv4(); const now = new Date().toISOString(); const config: ProcessConfig = { kind: 'process', command: parsed.command, args: parsed.args, cwd: parsed.cwd, }; const watch: WatchRecord = { id, kind: 'process', config, action_id: parsed.action_id ?? null, created_at: now, active: true, last_poll_at: null, }; insertWatch(watch); const watcher = new ProcessWatcher(id, parsed.action_id ?? null, this.registry.getNotifyFn(), config); this.registry.register(watcher); return { content: [{ type: 'text' as const, text: JSON.stringify({ watch_id: id, status: 'running', command: parsed.command }), }], }; } - src/server.ts:71-84 (registration)The definition and registration of the 'watch_process' tool in the MCP server tool list.
{ name: 'watch_process', description: 'Spawn and monitor a local process, capturing stdout/stderr and exit code', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'Command to run' }, args: { type: 'array', items: { type: 'string' }, description: 'Command arguments' }, cwd: { type: 'string', description: 'Working directory (optional)' }, action_id: { type: 'string', description: 'Link events to an agent action' }, }, required: ['command'], }, },