Skip to main content
Glama

pilot_frame_select

Switch browser automation context to a specific iframe by index or name, enabling subsequent interactions like clicking and filling forms within that frame.

Instructions

Switch context to an iframe by index or name. After switching, pilot_snapshot/click/fill will operate inside that iframe. Use pilot_frames to list available frames.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexNoFrame index from pilot_frames output
nameNoFrame name attribute

Implementation Reference

  • The handler implementation for the 'pilot_frame_select' tool, which takes an index or name to switch the browser context to a specific iframe.
    server.tool(
      'pilot_frame_select',
      'Switch context to an iframe by index or name. After switching, pilot_snapshot/click/fill will operate inside that iframe. Use pilot_frames to list available frames.',
      {
        index: z.number().optional().describe('Frame index from pilot_frames output'),
        name: z.string().optional().describe('Frame name attribute'),
      },
      async ({ index, name }) => {
        await bm.ensureBrowser();
        try {
          if (index !== undefined) {
            const frame = bm.selectFrameByIndex(index);
            return { content: [{ type: 'text' as const, text: `Switched to frame ${index} (${frame.url()}). Refs cleared — run pilot_snapshot for fresh refs.` }] };
          }
          if (name) {
            const frame = bm.selectFrameByName(name);
            return { content: [{ type: 'text' as const, text: `Switched to frame "${name}" (${frame.url()}). Refs cleared — run pilot_snapshot for fresh refs.` }] };
          }
          return { content: [{ type: 'text' as const, text: 'Provide index or name. Use pilot_frames to list available frames.' }], isError: true };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
        }
      }
    );

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