Skip to main content
Glama
nanoseil

MCP Background Task Server

by nanoseil

Send to Task Stdin

send-to-task-stdin

Send input data to running background tasks for interactive communication with long-running processes like development servers or builds.

Instructions

Sends data to the stdin of a running background task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesUnique name of the task
dataYesData to send to the task's stdin

Implementation Reference

  • The handler function for the 'send-to-task-stdin' tool. It retrieves the Child process by task name from the processes Map, and calls writeToStdin(data) on it, returning success or error message.
      async ({ name, data }) => {
        const child = processes.get(name);
        if (!child) {
          return {
            content: [
              {
                type: "text",
                text: `No task found with name "${name}".`,
              },
            ],
          };
        }
    
        try {
          child.writeToStdin(data);
          return {
            content: [
              {
                type: "text",
                text: `Data sent to task "${name}" stdin.`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to send data to task "${name}" stdin: ${
                  error instanceof Error ? error.message : String(error)
                }`,
              },
            ],
          };
        }
      }
    );
  • The schema definition for the 'send-to-task-stdin' tool, including title, description, and inputSchema using Zod for name and data parameters.
    {
      title: "Send to Task Stdin",
      description: "Sends data to the stdin of a running background task.",
      inputSchema: {
        name: z.string().describe("Unique name of the task"),
        data: z.string().describe("Data to send to the task's stdin"),
      },
    },
  • src/index.ts:251-297 (registration)
    The server.registerTool call that registers the 'send-to-task-stdin' tool with its schema and handler function.
    server.registerTool(
      "send-to-task-stdin",
      {
        title: "Send to Task Stdin",
        description: "Sends data to the stdin of a running background task.",
        inputSchema: {
          name: z.string().describe("Unique name of the task"),
          data: z.string().describe("Data to send to the task's stdin"),
        },
      },
      async ({ name, data }) => {
        const child = processes.get(name);
        if (!child) {
          return {
            content: [
              {
                type: "text",
                text: `No task found with name "${name}".`,
              },
            ],
          };
        }
    
        try {
          child.writeToStdin(data);
          return {
            content: [
              {
                type: "text",
                text: `Data sent to task "${name}" stdin.`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to send data to task "${name}" stdin: ${
                  error instanceof Error ? error.message : String(error)
                }`,
              },
            ],
          };
        }
      }
    );
  • The writeToStdin method in the Child class, which performs the actual writing to the child process's stdin using Node.js child_process.stdin.write.
    public writeToStdin(data: string): void {
      if (this.process.stdin) {
        this.process.stdin.write(data);
      } else {
        throw new Error("Child process stdin is not available.");
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions sending data to stdin but lacks details on behavioral traits such as whether this requires specific permissions, how data is processed, potential errors if the task isn't running, or rate limits, making it insufficient for a mutation tool with zero annotation coverage.

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?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words, making it appropriately sized and front-loaded for quick understanding.

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

Completeness2/5

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

Given the complexity of interacting with a running task (a mutation operation) and the lack of annotations and output schema, the description is incomplete. It does not cover important aspects like response behavior, error handling, or prerequisites, leaving significant gaps for an AI agent to use the tool effectively.

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 description coverage is 100%, so the schema already documents both parameters ('name' and 'data') adequately. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, resulting in a baseline score of 3.

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

Purpose5/5

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

The description clearly states the specific action ('Sends data') and target resource ('to the stdin of a running background task'), distinguishing it from sibling tools like get-task-stderr, get-task-stdout, list-background-tasks, run-background-task, and stop-background-task which have different purposes (reading output, listing, starting, or stopping tasks).

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?

The description implies usage by specifying 'a running background task', suggesting it should only be used when a task is active, but it does not explicitly state when to use this tool versus alternatives (e.g., when to send data vs. reading output) or provide exclusions, leaving some ambiguity.

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

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