Skip to main content
Glama

send_to_agent

Send text input to AI agents in terminal multiplexer workspaces. Use this tool to provide commands or queries to agents that are ready or idle for processing.

Instructions

Send text input to an agent. Agent must be in ready or idle state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent ID
textYesText to send
press_enterNoPress enter after sending text

Implementation Reference

  • The main implementation of the `sendToAgent` method that interacts with the agent client.
    async sendToAgent(
      agentId: string,
      text: string,
      pressEnter?: boolean,
    ): Promise<void> {
      const agent = this.registry.get(agentId);
      if (!agent) {
        throw new Error(`Agent not found: ${agentId}`);
      }
    
      if (!INTERACTIVE_STATES.has(agent.state)) {
        throw new Error(
          `Agent "${agentId}" is not in an interactive state (current: ${agent.state}). ` +
            `Must be in: ${[...INTERACTIVE_STATES].join(", ")}`,
        );
      }
    
      await this.client.send(agent.surface_id, text, {});
      if (pressEnter) {
        await this.client.sendKey(agent.surface_id, "return", {});
      }
    }
  • src/server.ts:862-880 (registration)
    The MCP tool registration for `send_to_agent`, which calls the `engine.sendToAgent` handler.
    server.tool(
      "send_to_agent",
      "Send text input to an agent. Agent must be in ready or idle state.",
      {
        agent_id: z.string().describe("Agent ID"),
        text: z.string().describe("Text to send"),
        press_enter: z
          .boolean()
          .optional()
          .default(true)
          .describe("Press enter after sending text"),
      },
      async (args) => {
        try {
          await engine.sendToAgent(args.agent_id, args.text, args.press_enter);
          return ok({
            agent_id: args.agent_id,
            applied: "send_to_agent",
          });
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 mentions the agent state requirement, which is useful context, but doesn't address other important behavioral aspects like whether this is a read-only or destructive operation, what permissions are needed, what happens if the agent isn't in the required state, or what the response/outcome looks like. For a tool that interacts with agents, this leaves significant gaps.

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 - just two short sentences that communicate the core purpose and a key constraint. Every word earns its place, and the most important information (what the tool does) is front-loaded.

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 that this is a tool that sends input to agents (potentially a mutation operation), the lack of annotations and output schema means the description should do more heavy lifting. While it mentions the agent state requirement, it doesn't explain what happens after sending the text, what kind of response to expect, or any error conditions. For a tool with no structured behavioral hints, this is incomplete.

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%, meaning all parameters are documented in the schema itself. The description doesn't add any additional parameter semantics beyond what's already in the schema (agent_id, text, press_enter). This meets the baseline expectation when 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 action ('Send text input') and target ('to an agent'), providing a specific verb and resource. However, it doesn't distinguish this tool from similar sibling tools like 'send_input' or 'interact', which likely have overlapping functionality.

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 provides an important precondition ('Agent must be in ready or idle state'), which gives some context for when to use this tool. However, it doesn't explain when to choose this tool over alternatives like 'send_input' or 'interact', nor does it provide explicit exclusions or comparisons with sibling tools.

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