Skip to main content
Glama

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
NameRequiredDescriptionDefault
commandYesCommand to run
argsNoCommand arguments
cwdNoWorking directory (optional)
action_idNoLink events to an agent action

Implementation Reference

  • 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'],
      },
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral burden. It successfully discloses that stdout/stderr/exit code are captured, but lacks critical execution details: whether spawning is blocking, timeout behavior, security implications of arbitrary command execution, or that it creates a persistent watch entity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single dense sentence with zero waste. Information is front-loaded with active verbs and concrete outcomes. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Appropriate for a 4-parameter tool with full schema coverage, but gaps remain regarding output structure (no output schema exists) and operational lifecycle. Given the sibling tool ecosystem (cancel_watch, poll_events), the description should mention that this creates a manageable watch instance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. The description does not add parameter-specific semantics beyond the schema (e.g., it does not clarify that 'command' expects absolute path or PATH-resolved executable, or explain the 'action_id' linkage pattern).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific actions (spawn, monitor, capture) and resource (local process) clearly. Implicitly distinguishes from siblings like watch_ci, watch_file, and watch_url by specifying 'local process', though it could be more explicit about scope differences.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides implied usage guidance by restricting scope to 'local process' versus sibling watch tools, but lacks explicit when-to-use/when-not-to-use guidance or mention of complementary lifecycle tools (cancel_watch, poll_events).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jarvisassistantux/loopsense'

If you have feedback or need assistance with the MCP directory API, please join our Discord server