get-task-stdout
Retrieve the standard output from a running background task to monitor its execution status and results.
Instructions
Retrieves the stdout of a running background task.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Unique name of the task |
Implementation Reference
- src/index.ts:190-213 (handler)The handler function retrieves the Child process instance for the specified task name and returns its accumulated stdout, or an error message if no such task exists.async ({ name }) => { const child = processes.get(name); if (!child) { return { content: [ { type: "text", text: `No task found with name "${name}".`, }, ], }; } return { content: [ { type: "text", text: `Stdout of task "${name}":\n${ child.stdout || "No output yet." }`, }, ], }; }
- src/index.ts:183-189 (schema)Input schema definition for the tool, specifying the required 'name' parameter as a string with Zod validation, along with title and description.{ title: "Get Task Stdout", description: "Retrieves the stdout of a running background task.", inputSchema: { name: z.string().describe("Unique name of the task"), }, },
- src/index.ts:181-214 (registration)The server.registerTool call that registers the 'get-task-stdout' tool, including its name, schema, and handler implementation.server.registerTool( "get-task-stdout", { title: "Get Task Stdout", description: "Retrieves the stdout of a running background task.", inputSchema: { name: z.string().describe("Unique name of the task"), }, }, async ({ name }) => { const child = processes.get(name); if (!child) { return { content: [ { type: "text", text: `No task found with name "${name}".`, }, ], }; } return { content: [ { type: "text", text: `Stdout of task "${name}":\n${ child.stdout || "No output yet." }`, }, ], }; } );