Skip to main content
Glama

stop_agent

Stop AI agents in the cmuxlayer terminal multiplexer by sending Ctrl+C for graceful termination or force killing processes when needed.

Instructions

Stop an agent gracefully (Ctrl+C) or forcefully (kill process).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent ID to stop
forceNoForce kill instead of graceful Ctrl+C

Implementation Reference

  • The core implementation of the stopAgent logic which handles checking if the agent exists, if it's already in a terminal state, and killing the process if force is true.
    async stopAgent(agentId: string, force?: boolean): Promise<void> {
      const agent = this.registry.get(agentId);
      if (!agent) {
        throw new Error(`Agent not found: ${agentId}`);
      }
    
      if (TERMINAL_STATES.has(agent.state)) {
        return; // Already stopped
      }
    
      if (force && agent.pid) {
        try {
          process.kill(agent.pid, "SIGKILL");
        } catch {
          // Process may already be dead — that's fine
        }
  • src/server.ts:835-855 (registration)
    Registration of the stop_agent MCP tool, including input schema validation and calling the engine's stopAgent method.
    server.tool(
      "stop_agent",
      "Stop an agent gracefully (Ctrl+C) or forcefully (kill process).",
      {
        agent_id: z.string().describe("Agent ID to stop"),
        force: z
          .boolean()
          .optional()
          .default(false)
          .describe("Force kill instead of graceful Ctrl+C"),
      },
      async (args) => {
        try {
          await engine.stopAgent(args.agent_id, args.force);
          const state = engine.getAgentState(args.agent_id);
          return ok({
            agent_id: args.agent_id,
            state: state?.state ?? "done",
            applied: "stop_agent",
          });
        } catch (e) {
Behavior3/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 describes the two stopping methods (graceful Ctrl+C and forceful kill), which adds useful context about how the tool behaves. However, it doesn't cover other important aspects like permissions needed, side effects, or what happens after stopping (e.g., cleanup, state changes), leaving 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 extremely concise (one sentence) and front-loaded with the core purpose. Every word earns its place by specifying the action, resource, and key behavioral options without any fluff or redundancy, making it highly efficient and easy to parse.

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

Completeness3/5

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

Given the tool's complexity (a mutation operation with no annotations and no output schema), the description is somewhat complete but has gaps. It covers the basic action and parameter semantics, but lacks details on outcomes, error conditions, or integration with sibling tools. For a tool that stops agents, more context about effects would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/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 thoroughly. The description adds value by explaining the semantics of the 'force' parameter ('Force kill instead of graceful Ctrl+C'), which clarifies the tool's behavior beyond the schema's technical details. This compensates well, though it doesn't add information for 'agent_id'.

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 ('Stop an agent') and distinguishes between two modes ('gracefully (Ctrl+C) or forcefully (kill process)'). It uses precise verbs and resource references, making the purpose immediately understandable and distinct from sibling tools like 'kill' or 'get_agent_state'.

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 mentioning two stopping methods (graceful vs. forceful), but it doesn't explicitly state when to use this tool versus alternatives like 'kill' or provide context about prerequisites. It offers some guidance through the parameter explanation but lacks explicit when/when-not instructions or named alternatives.

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/EtanHey/cmuxlayer'

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