Skip to main content
Glama
allegiant

MQScript MCP Server

by allegiant

mqscript_datetime_now

Retrieve current date and time in MQScript automation scripts for mobile device control, with customizable formatting options.

Instructions

Get current date and time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoDate format stringyyyy-MM-dd HH:mm:ss
resultVariableNoVariable name to store resultnow

Implementation Reference

  • The async handler function that generates and returns the MQScript command for getting current datetime based on input parameters.
    handler: async (args: { format?: string; resultVariable?: string }) => { const { format = 'yyyy-MM-dd HH:mm:ss', resultVariable = 'now' } = args; const script = `${resultVariable} = DateTime.Now("${format}")`; return { content: [ { type: 'text', text: `Generated MQScript DateTime now command:\n\`\`\`\n${script}\n\`\`\`\n\nThis gets current time in format "${format}" and stores it in "${resultVariable}".` } ] }; }
  • Input schema defining optional format and resultVariable parameters for the tool.
    inputSchema: { type: 'object' as const, properties: { format: { type: 'string', description: 'Date format string', default: 'yyyy-MM-dd HH:mm:ss' }, resultVariable: { type: 'string', description: 'Variable name to store result', default: 'now' } }, required: [] },
  • src/index.ts:64-72 (registration)
    Tool listing handler that exposes all tools including mqscript_datetime_now from ALL_TOOLS registry.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.values(ALL_TOOLS).map(tool => ({ name: tool.name, description: tool.description, inputSchema: tool.inputSchema, })), }; });
  • src/index.ts:75-88 (registration)
    Tool execution handler that looks up tool by name in ALL_TOOLS and calls 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)}`); } });
  • src/index.ts:32-61 (registration)
    Central ALL_TOOLS registry where DateTimeCommands (containing mqscript_datetime_now) is spread into the tool list.
    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, };

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