Skip to main content
Glama
nanoseil

MCP Background Task Server

by nanoseil

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
NameRequiredDescriptionDefault
nameYesUnique name of the task

Implementation Reference

  • 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."
            }`,
          },
        ],
      };
    }
  • 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."
              }`,
            },
          ],
        };
      }
    );

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