Skip to main content
Glama

pilot_page_forms

Extract all form fields from web pages as structured JSON data for browser automation and data processing tasks.

Instructions

Get all form fields on the page as structured JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Implementation of the 'pilot_page_forms' tool, which iterates through forms on the page and extracts their fields as structured JSON.
    server.tool(
      'pilot_page_forms',
      'Get all form fields on the page as structured JSON.',
      {},
      async () => {
        await bm.ensureBrowser();
        try {
          const forms = await bm.getPage().evaluate(() => {
            return [...document.querySelectorAll('form')].map((form, i) => {
              const fields = [...form.querySelectorAll('input, select, textarea')].map(el => {
                const input = el as HTMLInputElement;
                return {
                  tag: el.tagName.toLowerCase(),
                  type: input.type || undefined,
                  name: input.name || undefined,
                  id: input.id || undefined,
                  placeholder: input.placeholder || undefined,
                  required: input.required || undefined,
                  value: input.type === 'password' ? '[redacted]' : (input.value || undefined),
                };
              });
              return { index: i, action: form.action || undefined, method: form.method || 'get', id: form.id || undefined, fields };
            });
          });
          return { content: [{ type: 'text' as const, text: JSON.stringify(forms, null, 2) }] };
        } 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