Skip to main content
Glama

write_to_terminal

Send text or commands to the Windows terminal through the WinTerm MCP server, enabling AI models to interact with the command line interface.

Instructions

Write text or commands to the terminal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesThe text or command to write to the terminal

Implementation Reference

  • Handler for 'write_to_terminal' tool: spawns a shell process with the given command, captures stdout/stderr output, stores in outputBuffer, and resolves with the output and exit code.
    case 'write_to_terminal': {
      const { command } = request.params.arguments as { command: string };
      return new Promise((resolve, reject) => {
        const shell = os.platform() === 'win32' ? 'cmd.exe' : 'bash';
        const shellArgs = os.platform() === 'win32' ? ['/c', command] : ['-c', command];
        
        const proc = spawn(shell, shellArgs);
        let output = '';
    
        proc.stdout.on('data', (data) => {
          output += data.toString();
          this.outputBuffer.push(...data.toString().split('\n'));
        });
    
        proc.stderr.on('data', (data) => {
          output += data.toString();
          this.outputBuffer.push(...data.toString().split('\n'));
        });
    
        proc.on('close', (code) => {
          resolve({
            content: [
              {
                type: 'text',
                text: `Command executed with exit code ${code}. Output:\n${output}`,
              },
            ],
          });
        });
    
        proc.on('error', (err) => {
          reject(new McpError(ErrorCode.InternalError, err.message));
        });
      });
    }
  • src/index.ts:42-55 (registration)
    Registration of the 'write_to_terminal' tool in ListToolsRequestHandler, including name, description, and input schema for the command parameter.
    {
      name: 'write_to_terminal',
      description: 'Write text or commands to the terminal',
      inputSchema: {
        type: 'object',
        properties: {
          command: {
            type: 'string',
            description: 'The text or command to write to the terminal',
          },
        },
        required: ['command'],
      },
    },
  • Input schema definition for the 'write_to_terminal' tool, specifying a required 'command' string.
    inputSchema: {
      type: 'object',
      properties: {
        command: {
          type: 'string',
          description: 'The text or command to write to the terminal',
        },
      },
      required: ['command'],
    },
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 ('write') but doesn't clarify if this executes commands, requires specific permissions, has side effects, or how it interacts with the terminal state. This is inadequate for a tool that likely involves system interaction.

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 with zero waste. It is front-loaded and appropriately sized for the tool's simplicity, making it easy to parse 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?

Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like whether commands are executed, error handling, or return values, which are critical for a terminal interaction tool. The schema covers parameters well, but overall context is insufficient.

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 schema description coverage is 100%, so the schema already documents the single parameter 'command' as 'The text or command to write to the terminal'. The description adds no additional meaning beyond this, such as examples or constraints, but the schema provides sufficient baseline information.

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 ('write') and resource ('to the terminal'), specifying the action and target. However, it doesn't differentiate from sibling tools like 'send_control_character' which might also involve terminal interaction, leaving room for ambiguity about when to use each.

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 like 'send_control_character' or 'read_terminal_output'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

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/capecoma/winterm-mcp'

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