Skip to main content
Glama
nanoseil

MCP Background Task Server

by nanoseil

Stop Background Task

stop-background-task

Stop a running background task by its unique name to manage long-running processes like development servers or builds within MCP-compatible clients.

Instructions

Stops a running background task by its name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesUnique name of the task to stop

Implementation Reference

  • The main handler function for the 'stop-background-task' tool. It looks up the task by name in the processes Map, calls kill() on the Child instance if found, removes it from the map, and returns a text response.
    async ({ name }) => {
      const child = processes.get(name);
      if (!child) {
        return {
          content: [
            {
              type: "text",
              text: `No task found with name "${name}".`,
            },
          ],
        };
      }
    
      child.kill();
      processes.delete(name);
    
      return {
        content: [
          {
            type: "text",
            text: `Task "${name}" has been stopped.`,
          },
        ],
      };
    }
  • The tool metadata and input schema definition, specifying title, description, and Zod schema for the 'name' parameter.
    {
      title: "Stop Background Task",
      description: "Stops a running background task by its name.",
      inputSchema: {
        name: z.string().describe("Unique name of the task to stop"),
      },
  • src/index.ts:105-139 (registration)
    The full registration of the 'stop-background-task' tool using McpServer.registerTool, including name, schema, and inline handler function.
    server.registerTool(
      "stop-background-task",
      {
        title: "Stop Background Task",
        description: "Stops a running background task by its name.",
        inputSchema: {
          name: z.string().describe("Unique name of the task to stop"),
        },
      },
      async ({ name }) => {
        const child = processes.get(name);
        if (!child) {
          return {
            content: [
              {
                type: "text",
                text: `No task found with name "${name}".`,
              },
            ],
          };
        }
    
        child.kill();
        processes.delete(name);
    
        return {
          content: [
            {
              type: "text",
              text: `Task "${name}" has been stopped.`,
            },
          ],
        };
      }
    );
  • The kill() method in the Child class that terminates the child process using process.kill() and updates the state to 'stopped'. This is called by the tool handler.
    public kill(): void {
      if (this.process.killed) {
        return;
      }
      this.process.kill();
      this.state = "stopped";
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('stops') but doesn't cover critical traits like whether this is destructive (likely yes, but not confirmed), permission requirements, side effects (e.g., task termination effects), or error handling. This leaves significant gaps for a mutation tool.

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 function without unnecessary words. It's front-loaded with the core action, making it easy to parse and understand quickly.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., what 'stop' entails, success/failure responses) and doesn't compensate for the absence of structured data, making it inadequate for safe and effective use.

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?

The input schema has 100% description coverage, with the 'name' parameter fully documented. The description adds no additional meaning beyond implying the name is used for identification, which the schema already covers. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('stops') and resource ('a running background task'), specifying it's done 'by its name'. However, it doesn't explicitly differentiate from sibling tools like 'list-background-tasks' or 'run-background-task' in terms of purpose, which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as when a task should be stopped versus monitored or restarted. It lacks context about prerequisites (e.g., task must be running) or exclusions, offering only basic usage without strategic advice.

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