Skip to main content
Glama

fill_form_by_uid

Fill multiple form fields simultaneously by providing UID-value pairs for browser automation and testing workflows.

Instructions

Fill multiple form fields in one call using an array of {uid, value} pairs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementsYesArray of form field UIDs with their values

Implementation Reference

  • MCP tool handler: validates input array of {uid, value} pairs and delegates to Firefox client fillFormByUid method.
    export async function handleFillFormByUid(args: unknown): Promise<McpToolResponse> { try { const { elements } = args as { elements: Array<{ uid: string; value: string }> }; if (!elements || !Array.isArray(elements) || elements.length === 0) { throw new Error('elements parameter is required and must be a non-empty array'); } // Validate all elements for (const el of elements) { if (!el.uid || typeof el.uid !== 'string') { throw new Error(`Invalid element: uid is required and must be a string`); } if (el.value === undefined || typeof el.value !== 'string') { throw new Error(`Invalid element for uid "${el.uid}": value must be a string`); } } const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); try { await firefox.fillFormByUid(elements); return successResponse(`✅ filled ${elements.length} fields`); } catch (error) { const errorMsg = (error as Error).message; if (errorMsg.includes('stale') || errorMsg.includes('Snapshot') || errorMsg.includes('UID')) { throw new Error(`UIDs stale/invalid. Call take_snapshot first.`); } throw error; } } catch (error) { return errorResponse(error as Error); } }
  • Tool schema definition including inputSchema for validating {elements: [{uid: string, value: string}][]}
    export const fillFormByUidTool = { name: 'fill_form_by_uid', description: 'Fill multiple form fields at once.', inputSchema: { type: 'object', properties: { elements: { type: 'array', description: 'Array of {uid, value} pairs', items: { type: 'object', properties: { uid: { type: 'string', description: 'Field UID', }, value: { type: 'string', description: 'Field value', }, }, required: ['uid', 'value'], }, }, }, required: ['elements'], }, };
  • src/index.ts:103-147 (registration)
    Registration of tool handlers in the MCP server, mapping 'fill_form_by_uid' to handleFillFormByUid
    const toolHandlers = new Map< string, (input: unknown) => Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> >([ // Pages ['list_pages', tools.handleListPages], ['new_page', tools.handleNewPage], ['navigate_page', tools.handleNavigatePage], ['select_page', tools.handleSelectPage], ['close_page', tools.handleClosePage], // Script evaluation - DISABLED (see docs/future-features.md) // ['evaluate_script', tools.handleEvaluateScript], // Console ['list_console_messages', tools.handleListConsoleMessages], ['clear_console_messages', tools.handleClearConsoleMessages], // Network ['list_network_requests', tools.handleListNetworkRequests], ['get_network_request', tools.handleGetNetworkRequest], // Snapshot ['take_snapshot', tools.handleTakeSnapshot], ['resolve_uid_to_selector', tools.handleResolveUidToSelector], ['clear_snapshot', tools.handleClearSnapshot], // Input ['click_by_uid', tools.handleClickByUid], ['hover_by_uid', tools.handleHoverByUid], ['fill_by_uid', tools.handleFillByUid], ['drag_by_uid_to_uid', tools.handleDragByUidToUid], ['fill_form_by_uid', tools.handleFillFormByUid], ['upload_file_by_uid', tools.handleUploadFileByUid], // Screenshot ['screenshot_page', tools.handleScreenshotPage], ['screenshot_by_uid', tools.handleScreenshotByUid], // Utilities ['accept_dialog', tools.handleAcceptDialog], ['dismiss_dialog', tools.handleDismissDialog], ['navigate_history', tools.handleNavigateHistory], ['set_viewport_size', tools.handleSetViewportSize], ]);
  • src/index.ts:150-191 (registration)
    Registration of tool definitions (including fillFormByUidTool) for listTools endpoint
    const allTools = [ // Pages tools.listPagesTool, tools.newPageTool, tools.navigatePageTool, tools.selectPageTool, tools.closePageTool, // Script evaluation - DISABLED (see docs/future-features.md) // tools.evaluateScriptTool, // Console tools.listConsoleMessagesTool, tools.clearConsoleMessagesTool, // Network tools.listNetworkRequestsTool, tools.getNetworkRequestTool, // Snapshot tools.takeSnapshotTool, tools.resolveUidToSelectorTool, tools.clearSnapshotTool, // Input tools.clickByUidTool, tools.hoverByUidTool, tools.fillByUidTool, tools.dragByUidToUidTool, tools.fillFormByUidTool, tools.uploadFileByUidTool, // Screenshot tools.screenshotPageTool, tools.screenshotByUidTool, // Utilities tools.acceptDialogTool, tools.dismissDialogTool, tools.navigateHistoryTool, tools.setViewportSizeTool, ];
  • FirefoxClient wrapper method that delegates fillFormByUid to the DOM interaction module.
    async fillFormByUid(elements: Array<{ uid: string; value: string }>): Promise<void> { if (!this.dom) { throw new Error('Not connected'); } return await this.dom.fillFormByUid(elements); }

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/freema/firefox-devtools-mcp'

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