mqscript_abs
Calculate the absolute value of a number in mobile automation scripts, ensuring positive results for mathematical operations and conditional logic.
Instructions
Get absolute value of a number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | Number to get absolute value of | |
| resultVariable | No | Variable name to store result | result |
Implementation Reference
- src/tools/standard-library.ts:24-35 (handler)The handler function that generates MQScript code for computing the absolute value of a number and returns it as formatted content.handler: async (args: { number: number; resultVariable?: string }) => { const { number, resultVariable = 'result' } = args; const script = `${resultVariable} = Abs(${number})`; return { content: [ { type: 'text', text: `Generated MQScript absolute value function:\n\`\`\`\n${script}\n\`\`\`\n\nThis calculates the absolute value of ${number}.` } ] }; }
- src/tools/standard-library.ts:9-23 (schema)Input schema defining the parameters: number (required) and optional resultVariable for the mqscript_abs tool.inputSchema: { type: 'object' as const, properties: { number: { type: 'number', description: 'Number to get absolute value of' }, resultVariable: { type: 'string', description: 'Variable name to store result', default: 'result' } }, required: ['number'] },
- src/index.ts:40-40 (registration)Registration of mqscript_abs tool via spreading MathFunctions into the ALL_TOOLS object, which serves as the central tool registry for MCP server handlers....MathFunctions,
- src/index.ts:13-13 (registration)Import of MathFunctions containing the mqscript_abs tool definition.import { MathFunctions, StringFunctions, TypeConversionFunctions, ArrayFunctions } from './tools/standard-library.js';