mqscript_cint
Converts string values to integers for use in mobile automation scripts, enabling numerical operations and data processing in device control workflows.
Instructions
Convert value to integer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resultVariable | No | Variable name to store result | result |
| value | Yes | Value to convert to integer |
Implementation Reference
- src/tools/standard-library.ts:538-549 (handler)The handler function that implements the core logic of the 'mqscript_cint' tool. It takes a value and optional resultVariable, generates MQScript code using CInt for integer conversion, and returns a formatted text response with the generated script.handler: async (args: { value: string; resultVariable?: string }) => { const { value, resultVariable = 'result' } = args; const script = `${resultVariable} = CInt(${value})`; return { content: [ { type: 'text', text: `Generated MQScript integer conversion:\n\`\`\`\n${script}\n\`\`\`\n\nThis converts ${value} to integer.` } ] }; }
- The input schema defining the parameters for the 'mqscript_cint' tool: required 'value' string and optional 'resultVariable'.inputSchema: { type: 'object' as const, properties: { value: { type: 'string', description: 'Value to convert to integer' }, resultVariable: { type: 'string', description: 'Variable name to store result', default: 'result' } }, required: ['value'] },
- src/index.ts:32-61 (registration)The ALL_TOOLS object spreads TypeConversionFunctions (containing mqscript_cint) into the central tools registry used by listTools and callTool handlers for MCP server registration.const ALL_TOOLS = { // Basic Commands - 基础命令 ...TouchCommands, ...ControlCommands, ...ColorCommands, ...OtherCommands, // Standard Library - 标准库函数 ...MathFunctions, ...StringFunctions, ...TypeConversionFunctions, ...ArrayFunctions, // UI Commands - 界面命令 ...UIControlCommands, ...UIPropertyCommands, ...FloatingWindowCommands, // Extension Commands - 扩展命令 ...ElementCommands, ...DeviceCommands, ...PhoneCommands, ...SysCommands, // Plugin Commands - 插件命令 ...CJsonCommands, ...DateTimeCommands, ...FileCommands, ...TuringCommands, };