Skip to main content
Glama

pilot_frames

Lists all iframes on a webpage to enable context switching for browser automation tasks.

Instructions

List all frames (iframes) on the page. Use pilot_frame_select to switch context into an iframe for snapshot/interaction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'pilot_frames' tool.
    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 of the 'pilot_frames' tool.
    server.tool(
      'pilot_frames',
      'List all frames (iframes) on the page. Use pilot_frame_select to switch context into an iframe for snapshot/interaction.',

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