get-task-stderr
Retrieve stderr output from a running background task to monitor errors and debug processes in MCP server environments.
Instructions
Retrieves the stderr 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:225-248 (handler)Handler function that fetches the stderr output from the Child process instance for the given task name and returns it in the tool response format.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: `Stderr of task "${name}":\n${ child.stderr || "No error output yet." }`, }, ], }; }
- src/index.ts:218-224 (schema)Schema definition for the get-task-stderr tool, including title, description, and input schema requiring a task name.{ title: "Get Task Stderr", description: "Retrieves the stderr of a running background task.", inputSchema: { name: z.string().describe("Unique name of the task"), }, },
- src/index.ts:216-249 (registration)Registration of the get-task-stderr tool with the MCP server, including schema and handler.server.registerTool( "get-task-stderr", { title: "Get Task Stderr", description: "Retrieves the stderr 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: `Stderr of task "${name}":\n${ child.stderr || "No error output yet." }`, }, ], }; } );
- src/index.ts:22-24 (helper)Event listener that accumulates stderr output from the child process into the Child instance's stderr property.child.stderr?.on("data", (data) => { this.stderr += data.toString(); });
- src/index.ts:37-38 (helper)Getter method for accessing the accumulated stderr of a Child process instance.public getStderr(): string { return this.stderr;