Skip to main content
Glama

playwright_iframe_fill

Fill form elements within iframes using CSS selectors to automate interactions with embedded content in web pages.

Instructions

Fill an element in an iframe on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
iframeSelectorYesCSS selector for the iframe containing the element to fill
selectorYesCSS selector for the element to fill
valueYesValue to fill

Implementation Reference

  • IframeFillTool class that implements the core logic for the 'playwright_iframe_fill' tool using Playwright's frameLocator to locate the iframe and fill the specified element with the given value.
    export class IframeFillTool extends BrowserToolBase {
      /**
       * Execute the iframe fill tool
       */
      async execute(args: any, context: ToolContext): Promise<ToolResponse> {
        return this.safeExecute(context, async (page) => {
          const frame = page.frameLocator(args.iframeSelector);
          if (!frame) {
            return createErrorResponse(`Iframe not found: ${args.iframeSelector}`);
          }
    
          await frame.locator(args.selector).fill(args.value);
          return createSuccessResponse(
            `Filled element ${args.selector} inside iframe ${args.iframeSelector} with: ${args.value}`,
          );
        });
      }
    }
  • Tool schema definition including name, description, and input schema for validating arguments: iframeSelector, selector, and value.
    {
      name: "playwright_iframe_fill",
      description: "Fill an element in an iframe on the page",
      inputSchema: {
        type: "object",
        properties: {
          iframeSelector: { type: "string", description: "CSS selector for the iframe containing the element to fill" },
          selector: { type: "string", description: "CSS selector for the element to fill" },
          value: { type: "string", description: "Value to fill" },
        },
        required: ["iframeSelector", "selector", "value"],
      },
    },
  • Registration in the main tool handler switch statement that routes calls to 'playwright_iframe_fill' to the IframeFillTool instance's execute method.
    case "playwright_iframe_fill":
      return await iframeFillTool.execute(args, context);
  • Instantiation of the IframeFillTool instance used for handling the tool calls.
    if (!iframeFillTool) iframeFillTool = new IframeFillTool(server);
  • Import of IframeFillTool from the interaction module.
    IframeFillTool,
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions filling an element but doesn't disclose whether this is a mutation, requires page interaction, has side effects, or handles errors. For a tool with three parameters and no annotation coverage, this is inadequate.

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 that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, 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 tool's complexity (interacting with iframes, likely involving page state changes) and lack of annotations or output schema, the description is insufficient. It doesn't explain what 'fill' entails (e.g., input field population), potential errors, or return values, leaving significant gaps for an AI 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?

The input schema has 100% description coverage, clearly documenting all three parameters (iframeSelector, selector, value). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3.

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 ('Fill') and target ('an element in an iframe on the page'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'playwright_fill' (which presumably fills elements not in iframes), so it misses the highest score.

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 is provided on when to use this tool versus alternatives like 'playwright_fill' or other iframe-related tools such as 'playwright_iframe_click'. The description implies usage for iframe elements but doesn't specify prerequisites, exclusions, or contextual alternatives.

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/aakashH242/mcp-playwright'

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