Skip to main content
Glama

fill

Fill input fields in Tauri apps using CSS selector or snapshot ref. Optionally target a specific window.

Instructions

Fill input by ref or selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoRef from snapshot
selectorNoCSS selector
valueYesValue
windowNoWindow label (default: focused window)

Implementation Reference

  • The fill tool handler function that validates input (ref or selector required), calls socketManager.fill(), and returns the result as text content.
    fill: async (args: { ref?: number; selector?: string; value: string; window?: string }) => {
      if (args.ref == null && !args.selector) {
        throw new Error('Either ref or selector must be provided');
      }
      const result = await socketManager.fill(args);
      return {
        content: [
          {
            type: 'text' as const,
            text: result,
          },
        ],
      };
    },
  • The fill tool schema definition with name 'fill', description 'Fill input by ref or selector', and inputSchema with optional ref (number), optional selector (string), required value (string), and optional window (string).
    fill: {
      name: 'fill',
      description: 'Fill input by ref or selector',
      inputSchema: z.object({
        ref: z.number().optional().describe('Ref from snapshot'),
        selector: z.string().optional().describe('CSS selector'),
        value: z.string().describe('Value'),
        window: z.string().optional().describe('Window label (default: focused window)'),
      }),
    },
  • The fill tool is registered in the DEFAULT_ESSENTIAL_TOOLS array in the MCP server, making it available as a default tool.
    const DEFAULT_ESSENTIAL_TOOLS = [
      'get_session_status',
      'start_session',
      'stop_session',
      'snapshot',
      'click',
      'fill',
      'screenshot',
      'navigate',
    ];
  • The SocketManager.fill() helper that sends a 'fill' JSON-RPC command over the Unix socket to the Tauri app, handling the response and formatting the success message.
    async fill(options: { ref?: number; selector?: string; value: string; window?: string }): Promise<string> {
      const result = await this.sendCommand('fill', options) as { success: boolean; error?: string };
      if (!result.success) {
        throw new Error(result.error || 'Fill failed');
      }
      const target = options.ref ? `ref=${options.ref}` : options.selector;
      const windowInfo = options.window ? ` in window '${options.window}'` : '';
      return `Filled ${target} with "${options.value}"${windowInfo}`;
    }
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as whether it clears the existing value, supports file inputs, or handles non-input elements. The brief description leaves significant ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (5 words) and front-loaded. However, it may be too brief, sacrificing necessary detail for brevity.

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 simplicity and lack of output schema, the description is incomplete: it does not specify the behavior on different input types, whether it simulates typing or sets value programmatically, or error scenarios.

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 coverage is 100% with descriptions for all 4 parameters. The description adds 'by ref or selector' to clarify parameter usage, but does not add further semantic meaning beyond the schema.

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 'fill' and resource 'input', and specifies the method 'by ref or selector'. It is clear but does not differentiate from siblings like 'click' or 'press_key'.

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?

No guidance on when to use this tool versus alternatives (e.g., 'press_key' for key presses, 'click' for clicks). No context or exclusions provided.

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/DaveDev42/tauri-plugin-mcp'

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