Skip to main content
Glama

stop_server

Stop a running server by specifying its process name to terminate the process and free system resources.

Instructions

Stop a running server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProcess name

Implementation Reference

  • The main handler for the stop_server tool. Looks up the process by name, sends SIGTERM (graceful), waits 1 second, then force kills with SIGKILL if still running. Returns success or error message.
    async stopServer(args: StopServerArgs): Promise<ToolResult> {
      const { name } = args;
      ValidationUtils.validateRequired({ name }, ['name']);
      
      const processInfo = this.activeProcesses.get(name);
      if (!processInfo) {
        return {
          content: [{
            type: 'text',
            text: `No process found with name: ${name}`,
          }],
        };
      }
      
      try {
        processInfo.process.kill('SIGTERM');
        
        // Wait a bit for graceful shutdown
        await new Promise(resolve => setTimeout(resolve, 1000));
        
        // Force kill if still running
        if (!processInfo.process.killed) {
          processInfo.process.kill('SIGKILL');
        }
        
        this.activeProcesses.delete(name);
        
        return {
          content: [{
            type: 'text',
            text: `Server "${name}" stopped successfully`,
          }],
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error stopping server "${name}": ${error instanceof Error ? error.message : 'Unknown error'}`,
          }],
        };
      }
    }
  • TypeScript interface for stop_server arguments - requires a 'name' string field.
    export interface StopServerArgs {
      name: string;
    }
  • Tool definition registration for stop_server with input schema requiring a 'name' property.
    {
      name: 'stop_server',
      description: 'Stop a running server',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', description: 'Process name' },
        },
        required: ['name'],
      },
    },
  • src/index.ts:243-244 (registration)
    Routing logic in executeToolCommand that dispatches 'stop_server' calls to ProcessService.stopServer().
    case 'stop_server':
      return await this.processService.stopServer(args as StopServerArgs);
  • Helper method that stops all active processes by calling stopServer for each one, used during cleanup.
    async stopAllProcesses(): Promise<void> {
      const promises = Array.from(this.activeProcesses.keys()).map(name => 
        this.stopServer({ name }).catch(() => {
          // Ignore errors during cleanup
        })
      );
      
      await Promise.all(promises);
    }
Behavior2/5

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

With no annotations, the description must convey behavioral traits. It does not disclose whether the stop is graceful, forceful, or requires permissions. The agent gets no sense of potential side effects or safety considerations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no unnecessary words. It is concise but lacks detail that would improve its usefulness without adding length.

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 tool's simplicity (one parameter, no output schema), the description is insufficient. It does not explain return behavior, error conditions, or what 'stop' entails operationally (e.g., signal sent, whether it waits for shutdown).

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 coverage is 100% with a single parameter 'name' described as 'Process name'. The description adds no additional meaning beyond what the schema already provides, so baseline of 3 is appropriate.

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 'Stop a running server' uses a clear verb and resource, directly stating the action. It distinguishes from sibling 'start_server' by the opposite action, and from other tools by focusing specifically on server processes.

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?

No guidance on when to use this tool versus alternatives such as 'run_command' or 'secure_run_command' to manually stop a process. No context on prerequisites (e.g., server must be started) or when not to use.

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/agentics-ai/code-mcp'

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