Skip to main content
Glama

send_key

Submit terminal commands by sending key presses to interactive programs like Claude sessions after text input.

Instructions

Send a key press to a terminal surface. Use this after send_input to reliably submit commands — especially when targeting interactive programs like Claude sessions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
surfaceYesTarget surface ref
keyYesKey name (e.g. 'return', 'escape', 'tab')
workspaceNoTarget workspace ref

Implementation Reference

  • The tool handler for "send_key" which invokes the client's sendKey method.
    async (args) => {
      try {
        await client.sendKey(args.surface, args.key, {
          workspace: args.workspace,
        });
        return ok({ surface: args.surface, applied: "send_key" });
      } catch (e) {
        return err(e);
      }
  • src/server.ts:323-330 (registration)
    Registration of the "send_key" MCP tool in server.ts.
    server.tool(
      "send_key",
      "Send a key press to a terminal surface. Use this after send_input to reliably submit commands — especially when targeting interactive programs like Claude sessions.",
      {
        surface: z.string().describe("Target surface ref"),
        key: z.string().describe("Key name (e.g. 'return', 'escape', 'tab')"),
        workspace: z.string().optional().describe("Target workspace ref"),
      },
  • The client-side implementation of sendKey which sends the "send-key" command to the cmux process.
    async sendKey(
      surface: string,
      key: string,
      opts?: { workspace?: string },
    ): Promise<void> {
      const args = ["send-key", "--surface", surface];
      if (opts?.workspace) args.push("--workspace", opts.workspace);
      args.push(key);
      await this.run(args);
    }
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 mentions the tool's purpose for 'reliably submit commands' which implies it handles key press simulation, but doesn't disclose potential side effects, error conditions, or what happens if the surface doesn't exist. It provides some context about when to use it but lacks details about behavioral constraints or limitations.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core functionality, and the second provides crucial usage guidance. There's zero wasted language, and the most important information (what it does) comes first.

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

Completeness4/5

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

For a tool with 3 parameters, 100% schema coverage, and no output schema, the description provides good contextual completeness. It explains the tool's purpose, when to use it, and how it relates to other tools. However, without annotations or output schema, it could benefit from more details about what constitutes success/failure or typical response patterns.

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?

With 100% schema description coverage, the schema already documents all three parameters. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions the general purpose but provides no additional details about parameter usage, constraints, or examples beyond the schema's basic descriptions.

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 ('send a key press') and target ('to a terminal surface'), distinguishing it from sibling tools like send_input (which sends text) or interact (which may handle broader interactions). It provides a concrete verb+resource combination that leaves no ambiguity about the tool's function.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool ('Use this after send_input to reliably submit commands') and provides a specific use case ('especially when targeting interactive programs like Claude sessions'). It clearly differentiates from send_input by explaining the sequential relationship and specialized purpose for command submission.

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