Skip to main content
Glama
allegiant

MQScript MCP Server

by allegiant

mqscript_datetime_adddays

Add specified days to a date-time variable in MQScript mobile automation, storing the result for scheduling or time-based operations.

Instructions

Add days to date time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateTimeVariableYesDateTime variable name
daysYesNumber of days to add
resultVariableNoVariable name to store resultnewDate

Implementation Reference

  • The handler function that generates MQScript code for DateTime.AddDays operation and returns a response with the generated script.
    handler: async (args: { dateTimeVariable: string; days: number; resultVariable?: string }) => {
      const { dateTimeVariable, days, resultVariable = 'newDate' } = args;
      const script = `${resultVariable} = DateTime.AddDays(${dateTimeVariable}, ${days})`;
      return {
        content: [
          {
            type: 'text',
            text: `Generated MQScript DateTime add days command:\n\`\`\`\n${script}\n\`\`\`\n\nThis adds ${days} days to "${dateTimeVariable}".`
          }
        ]
      };
    }
  • Defines the input schema for the tool, including required dateTimeVariable and days parameters, and optional resultVariable.
    inputSchema: {
      type: 'object' as const,
      properties: {
        dateTimeVariable: {
          type: 'string',
          description: 'DateTime variable name'
        },
        days: {
          type: 'number',
          description: 'Number of days to add'
        },
        resultVariable: {
          type: 'string',
          description: 'Variable name to store result',
          default: 'newDate'
        }
      },
      required: ['dateTimeVariable', 'days']
    },
  • src/index.ts:32-61 (registration)
    The ALL_TOOLS registry spreads DateTimeCommands (containing mqscript_datetime_adddays) for tool discovery and execution.
    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,
    };
  • src/index.ts:75-88 (registration)
    Registers the generic CallToolRequest handler that looks up the tool by name from ALL_TOOLS and invokes its handler.
    server.setRequestHandler(CallToolRequestSchema, async (request: CallToolRequest) => {
      const { name, arguments: args } = request.params;
      
      const tool = Object.values(ALL_TOOLS).find(t => t.name === name);
      if (!tool) {
        throw new Error(`Unknown tool: ${name}`);
      }
      
      try {
        return await tool.handler(args as any || {});
      } catch (error) {
        throw new Error(`Error executing tool ${name}: ${error instanceof Error ? error.message : String(error)}`);
      }
    });
Install Server

Other 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/allegiant/MQScript_MCP'

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