Skip to main content
Glama
nanoseil
by nanoseil

get-task-stdout

Retrieve the standard output (stdout) of a running background task by specifying its unique name, enabling real-time monitoring and debugging within the MCP Background Task Server.

Instructions

Retrieves the stdout of a running background task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesUnique name of the task

Implementation Reference

  • src/index.ts:181-214 (registration)
    Registers the 'get-task-stdout' MCP tool with server.registerTool, providing the tool name, schema (title, description, inputSchema), and handler function.
    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." }`, }, ], }; } );
  • Handler function that retrieves the Child process instance by task name from the global processes Map, checks if it exists, and returns a response containing the accumulated stdout or a no-task message.
    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." }`, }, ], }; }
  • Tool schema definition including title, description, and Zod input schema requiring a single 'name' string parameter.
    { title: "Get Task Stdout", description: "Retrieves the stdout of a running background task.", inputSchema: { name: z.string().describe("Unique name of the task"), }, },
  • Helper method on the Child class to retrieve the accumulated stdout string (though accessed directly in the handler).
    public getStdout(): string { return this.stdout; }
  • Global Map storing active background tasks by name, used to retrieve Child instance in the handler.
    const processes = new Map<string, Child>();

Other Tools

Related 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/nanoseil/mcp-bgtask'

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