mqscript_element_settext
Set text content to UI elements in mobile automation scripts using element IDs or selectors to populate fields and update interface components.
Instructions
Set text to UI element
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| elementId | Yes | Element ID or selector | |
| text | Yes | Text to set |
Implementation Reference
- src/tools/extension-commands.ts:84-95 (handler)The handler function that generates MQScript code `Element.SetText(elementId, text)` and returns a formatted text response describing the generated script.handler: async (args: { elementId: string; text: string }) => { const { elementId, text } = args; const script = `Element.SetText("${elementId}", "${text}")`; return { content: [ { type: 'text', text: `Generated MQScript set element text command:\n\`\`\`\n${script}\n\`\`\`\n\nThis sets text of element "${elementId}" to "${text}".` } ] }; }
- Input schema defining the required 'elementId' (string) and 'text' (string) parameters for the tool.inputSchema: { type: 'object' as const, properties: { elementId: { type: 'string', description: 'Element ID or selector' }, text: { type: 'string', description: 'Text to set' } }, required: ['elementId', 'text'] },
- src/tools/extension-commands.ts:67-96 (registration)The complete tool definition object for 'mqscript_element_settext' within ElementCommands, which is imported and registered in the MCP server.setText: { name: 'mqscript_element_settext', description: 'Set text to UI element', inputSchema: { type: 'object' as const, properties: { elementId: { type: 'string', description: 'Element ID or selector' }, text: { type: 'string', description: 'Text to set' } }, required: ['elementId', 'text'] }, handler: async (args: { elementId: string; text: string }) => { const { elementId, text } = args; const script = `Element.SetText("${elementId}", "${text}")`; return { content: [ { type: 'text', text: `Generated MQScript set element text command:\n\`\`\`\n${script}\n\`\`\`\n\nThis sets text of element "${elementId}" to "${text}".` } ] }; } },
- src/index.ts:50-54 (registration)Registration of ElementCommands (containing the tool) into the ALL_TOOLS registry used by the MCP server for tool listing and execution.// Extension Commands - 扩展命令 ...ElementCommands, ...DeviceCommands, ...PhoneCommands, ...SysCommands,
- src/index.ts:15-15 (registration)Import of ElementCommands from extension-commands.ts into the main MCP server index.ts.import { ElementCommands, DeviceCommands, PhoneCommands, SysCommands } from './tools/extension-commands.js';