Skip to main content
Glama

ui_type

Input text directly into the iOS Simulator using a specified UDID. Simplifies interaction by enabling precise text entry for UI testing and automation.

Instructions

Input text into the iOS Simulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to input
udidNoUdid of target, can also be set with the IDB_UDID env var

Implementation Reference

  • The handler function for the 'ui_type' tool. It resolves the simulator UDID if not provided, executes the 'idb ui text' command with the input text, and returns success or error response.
    async ({ udid, text }) => { try { const actualUdid = await getBootedDeviceId(udid); const { stderr } = await idb( "ui", "text", "--udid", actualUdid, // When passing user-provided values to a command, it's crucial to use `--` // to separate the command's options from positional arguments. // This prevents the shell from misinterpreting the arguments as options. "--", text ); if (stderr) throw new Error(stderr); return { isError: false, content: [{ type: "text", text: "Typed successfully" }], }; } catch (error) { return { isError: true, content: [ { type: "text", text: errorWithTroubleshooting( `Error typing text into the iOS Simulator: ${ toError(error).message }` ), }, ], }; } } );
  • Zod schema for input validation: optional UDID matching UUID pattern, and text limited to 500 printable ASCII characters.
    { udid: z .string() .regex(UDID_REGEX) .optional() .describe("Udid of target, can also be set with the IDB_UDID env var"), text: z .string() .max(500) .regex(/^[\x20-\x7E]+$/) .describe("Text to input"), },
  • src/index.ts:330-385 (registration)
    Conditional registration of the 'ui_type' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    if (!isToolFiltered("ui_type")) { server.tool( "ui_type", "Input text into the iOS Simulator", { udid: z .string() .regex(UDID_REGEX) .optional() .describe("Udid of target, can also be set with the IDB_UDID env var"), text: z .string() .max(500) .regex(/^[\x20-\x7E]+$/) .describe("Text to input"), }, async ({ udid, text }) => { try { const actualUdid = await getBootedDeviceId(udid); const { stderr } = await idb( "ui", "text", "--udid", actualUdid, // When passing user-provided values to a command, it's crucial to use `--` // to separate the command's options from positional arguments. // This prevents the shell from misinterpreting the arguments as options. "--", text ); if (stderr) throw new Error(stderr); return { isError: false, content: [{ type: "text", text: "Typed successfully" }], }; } catch (error) { return { isError: true, content: [ { type: "text", text: errorWithTroubleshooting( `Error typing text into the iOS Simulator: ${ toError(error).message }` ), }, ], }; } } ); }

Other Tools

Related Tools

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/joshuayoes/ios-simulator-mcp'

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