Skip to main content
Glama

select_page

Set a specific browser page as the active context for subsequent Chrome DevTools automation commands, enabling targeted debugging and inspection tasks.

Instructions

Select a page as a context for future tool calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdxYesThe index of the page to select. Call list_pages to list pages.

Implementation Reference

  • Handler function that retrieves the page by index using context.getPageByIdx, brings it to the front, sets it as the selected page, and instructs the response to include pages.
    handler: async (request, response, context) => {
      const page = context.getPageByIdx(request.params.pageIdx);
      await page.bringToFront();
      context.setSelectedPageIdx(request.params.pageIdx);
      response.setIncludePages(true);
    },
  • Input schema defining pageIdx as a number, with description instructing to use list_pages first.
    schema: {
      pageIdx: z
        .number()
        .describe(
          'The index of the page to select. Call list_pages to list pages.',
        ),
    },
  • Full tool definition and export using defineTool, including name 'select_page', description, annotations, schema, and handler. This registers the tool.
    export const selectPage = defineTool({
      name: 'select_page',
      description: `Select a page as a context for future tool calls.`,
      annotations: {
        category: ToolCategories.NAVIGATION_AUTOMATION,
        readOnlyHint: true,
      },
      schema: {
        pageIdx: z
          .number()
          .describe(
            'The index of the page to select. Call list_pages to list pages.',
          ),
      },
      handler: async (request, response, context) => {
        const page = context.getPageByIdx(request.params.pageIdx);
        await page.bringToFront();
        context.setSelectedPageIdx(request.params.pageIdx);
        response.setIncludePages(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/SHAY5555-gif/chrome-devtools-mcp'

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