Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

set_clipboard

Copies text to the Windows clipboard for pasting into other applications. Use this tool to set clipboard content programmatically.

Instructions

设置剪贴板内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes要设置的文本内容

Implementation Reference

  • The setClipboard method that executes the tool logic: escapes text and runs PowerShell Set-Clipboard command.
    async setClipboard(text) {
      try {
        // 转义特殊字符
        const escapedText = text.replace(/"/g, '`"').replace(/\$/g, '`$');
        await execAsync(`powershell -Command "Set-Clipboard -Value '${escapedText}'"`, {
          shell: 'powershell.exe'
        });
        return { success: true, message: '剪贴板已设置', length: text.length };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Tool schema definition including name, description, and inputSchema requiring 'text' string.
    {
      name: 'set_clipboard',
      description: '设置剪贴板内容',
      inputSchema: {
        type: 'object',
        properties: {
          text: { type: 'string', description: '要设置的文本内容' },
        },
        required: ['text'],
      },
    },
  • getToolDefinitions() method registers the set_clipboard tool schema by including it in the returned array.
    getToolDefinitions() {
      return [
        {
          name: 'get_clipboard',
          description: '获取剪贴板内容',
          inputSchema: {
            type: 'object',
            properties: {},
          },
        },
        {
          name: 'set_clipboard',
          description: '设置剪贴板内容',
          inputSchema: {
            type: 'object',
            properties: {
              text: { type: 'string', description: '要设置的文本内容' },
            },
            required: ['text'],
          },
        },
        {
          name: 'clear_clipboard',
          description: '清空剪贴板',
          inputSchema: {
            type: 'object',
            properties: {},
          },
        },
      ];
  • canHandle checks if tool is set_clipboard; executeTool dispatches set_clipboard calls to setClipboard handler.
    canHandle(toolName) {
      const tools = ['get_clipboard', 'set_clipboard', 'clear_clipboard'];
      return tools.includes(toolName);
    }
    
    async executeTool(name, args) {
      switch (name) {
        case 'get_clipboard':
          return await this.getClipboard();
        case 'set_clipboard':
          return await this.setClipboard(args.text);
        case 'clear_clipboard':
          return await this.clearClipboard();
        default:
          throw new Error(`未知工具: ${name}`);
      }
    }
  • src/server.js:49-52 (registration)
    Server instantiates ClipboardTools instance, which provides set_clipboard via getToolDefinitions and executeTool.
      clipboard: new ClipboardTools(),
      powershell: new PowerShellTools(),
      browser: new BrowserTools(),
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('设置' - set) but doesn't describe what happens (e.g., overwrites existing content, requires permissions, system-specific behavior, or potential side effects). For a mutation tool with zero 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, direct phrase ('设置剪贴板内容') with zero wasted words. It's front-loaded and efficiently conveys the core action without unnecessary elaboration, making it highly concise and well-structured for its purpose.

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 (a mutation operation with no annotations and no output schema), the description is incomplete. It lacks details on behavioral traits (e.g., what happens to existing clipboard data), error conditions, or return values. For a tool that modifies system state, more context is needed to ensure safe and effective use.

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%, with the parameter 'text' fully documented as '要设置的文本内容' (text content to set). The description doesn't add any meaning beyond this, such as format constraints or examples. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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 '设置剪贴板内容' (Set clipboard content) clearly states the verb ('设置' - set) and resource ('剪贴板内容' - clipboard content), making the purpose unambiguous. It doesn't explicitly differentiate from sibling tools like 'clear_clipboard' or 'get_clipboard', but the action is specific enough to understand its function.

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. It doesn't mention sibling tools like 'clear_clipboard' (for emptying) or 'get_clipboard' (for reading), nor does it specify prerequisites or contexts for setting clipboard content, leaving usage unclear.

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