Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

press_key

Simulate keyboard key presses on Windows systems. Specify keys like enter, tab, or escape, optionally with modifiers such as control or shift, to automate typing tasks.

Instructions

按下键盘按键

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes按键名称(如 enter, tab, escape)
modifiersNo修饰键(如 control, shift, alt)

Implementation Reference

  • The pressKey method that executes the core logic of the 'press_key' tool using robotjs.keyTap(key, modifiers). Returns success status and details.
    pressKey(key, modifiers = []) {
      try {
        if (modifiers.length > 0) {
          this.robot.keyTap(key, modifiers);
        } else {
          this.robot.keyTap(key);
        }
        return { success: true, key, modifiers, message: '按键已按下' };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • The tool definition object in getToolDefinitions() that registers the 'press_key' tool name and its input schema (key required, modifiers optional).
    {
      name: 'press_key',
      description: '按下键盘按键',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '按键名称(如 enter, tab, escape)' },
          modifiers: { type: 'array', items: { type: 'string' }, description: '修饰键(如 control, shift, alt)' },
        },
        required: ['key'],
      },
    },
  • Dispatch logic in executeTool switch statement that handles 'press_key' by calling the pressKey handler with parsed arguments.
    case 'press_key':
      return this.pressKey(args.key, args.modifiers);
  • Inclusion of 'press_key' in the canHandle tool list, enabling routing in the main server handleToolCall.
    const tools = ['move_mouse', 'mouse_click', 'type_text', 'press_key', 
                   'get_mouse_position', 'get_screen_size'];
  • src/server.js:46-46 (registration)
    Instantiation of MouseKeyboardTools class in the main server, which provides the press_key tool via getToolDefinitions and executeTool.
    mouseKeyboard: new MouseKeyboardTools(),
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states the action ('press keyboard key') but lacks critical details: whether this simulates a single key press/release, requires focus on a specific application, has side effects (e.g., triggering system shortcuts), or handles international keyboards. For a tool with potential system-wide impact and no annotation coverage, this is a significant gap in transparency.

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 phrase ('按下键盘按键') that directly conveys the core action without any fluff. It's front-loaded with the essential verb and object, making it immediately understandable. Every word earns its place, and there's no wasted text or redundant elaboration.

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 complexity (interacting with system input, 2 parameters) and lack of annotations or output schema, the description is incomplete. It doesn't cover behavioral aspects like error handling (e.g., invalid key names), return values (e.g., success status), or system dependencies (e.g., OS compatibility). For a low-level input simulation tool, more context is needed to ensure safe and effective use by an agent.

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%, with clear documentation for 'key' (key name like enter) and 'modifiers' (modifier keys like control). The description adds no parameter-specific information beyond what's in the schema, such as examples of valid key names beyond 'enter, tab, escape' or how modifiers combine. With high schema coverage, the baseline score of 3 is appropriate as 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 '按下键盘按键' (press keyboard key) clearly states the action (press) and target (keyboard key) in a simple verb+resource format. It distinguishes from sibling tools like 'type_text' (which inputs text strings) and 'mouse_click' (which handles mouse actions), making the purpose specific and unambiguous. However, it doesn't explicitly mention virtual/software keyboard simulation versus physical hardware interaction.

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 'type_text' (for text input) or 'browser_type' (for browser-specific typing). There's no mention of prerequisites (e.g., needing a focused window), typical use cases (e.g., automation shortcuts), or exclusions (e.g., not for continuous key holding). This leaves the agent to infer usage from context 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/eva-wanxin-git/windows-automation-mcp'

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