Skip to main content
Glama

pilot_frames

List all iframes on the current page with their indices, names, and URLs to locate and verify page structure before switching frames.

Instructions

List all frames (iframes) on the current page with their indices, names, and URLs. Use when the user wants to see what iframes exist on the page, find an iframe to interact with, or verify the page structure before switching frame context. The main frame is always index 0. Use pilot_frame_select to switch into an iframe.

Parameters: (none)

Returns: Numbered list of frames showing index, type ([main] or [iframe name="..."]), URL, and an arrow (→) marking the currently active frame. Returns "(no iframes — only the main frame)" if no iframes exist.

Errors: None.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'pilot_frames' tool. Calls bm.listFrames() to get all frames, formats them with index, type ([main]/[iframe]), URL, and marks the active frame with '→'. Returns '(no iframes — only the main frame)' if only main frame exists.
      server.tool(
        'pilot_frames',
        `List all frames (iframes) on the current page with their indices, names, and URLs.
    Use when the user wants to see what iframes exist on the page, find an iframe to interact with, or verify the page structure before switching frame context. The main frame is always index 0. Use pilot_frame_select to switch into an iframe.
    
    Parameters: (none)
    
    Returns: Numbered list of frames showing index, type ([main] or [iframe name="..."]), URL, and an arrow (→) marking the currently active frame. Returns "(no iframes — only the main frame)" if no iframes exist.
    
    Errors: None.`,
        {},
        async () => {
          await bm.ensureBrowser();
          try {
            const frames = await bm.listFrames();
            if (frames.length <= 1) {
              return { content: [{ type: 'text' as const, text: '(no iframes — only the main frame)' }] };
            }
            const activeFrame = bm.getActiveFrame();
            const page = bm.getPage();
            const allFrames = page.frames();
            const text = frames.map(f => {
              const isCurrent = allFrames[f.index] === activeFrame;
              const marker = isCurrent ? '→ ' : '  ';
              const label = f.isMain ? '[main]' : `[iframe${f.name ? ` name="${f.name}"` : ''}]`;
              return `${marker}[${f.index}] ${label} ${f.url}`;
            }).join('\n');
            return { content: [{ type: 'text' as const, text }] };
          } catch (err) {
            return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
          }
        }
  • Registration call: registerIframeTools(effectiveServer, bm) which registers 'pilot_frames' among other frame tools.
    registerIframeTools(effectiveServer, bm);
  • 'pilot_frames' listed in the STANDARD_TOOLS set, meaning it's available in 'standard' and 'full' tool profiles.
      'pilot_frames', 'pilot_frame_select', 'pilot_frame_reset',
      // session + config
      'pilot_auth', 'pilot_block', 'pilot_find',
    ]);
  • Helper method listFrames() used by the handler. Returns an array of frame objects with index, url, name, and isMain by mapping over page.frames().
    async listFrames(): Promise<Array<{ index: number; url: string; name: string; isMain: boolean }>> {
      const page = this.getPage();
      return page.frames().map((f, i) => ({
        index: i,
        url: f.url(),
        name: f.name() || '',
        isMain: f === page.mainFrame(),
      }));
    }
  • Helper method getActiveFrame() used by the handler to determine which frame is currently active for the arrow marker.
    getActiveFrame(): Frame {
      if (this.activeFrame && !this.activeFrame.isDetached()) {
        return this.activeFrame;
      }
      this.activeFrame = null;
      return this.getPage().mainFrame();
    }
Behavior5/5

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

Describes exactly what the tool returns (numbered list with index, type, URL, active frame arrow) and what happens when no iframes exist. States 'Errors: None', so the user knows it's safe. Even without annotations, the description fully discloses behavior.

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 very concise, with each sentence adding value. It is front-loaded with the main purpose, then usage guidance, then returns. No extraneous text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with zero parameters and no output schema, the description fully explains the return format and edge cases. No additional information is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, and schema coverage is 100%. Per rules, baseline is 4. The description adds no parameter detail because none are needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool lists all frames on the current page with indices, names, and URLs. It distinguishes itself from sibling tools like pilot_frame_select by explicitly mentioning that tool for switching contexts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use scenarios: to see existing iframes, find one to interact with, or verify page structure before switching. Also tells the user to use pilot_frame_select to switch, giving clear 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/TacosyHorchata/Pilot'

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