Skip to main content
Glama
allegiant

MQScript MCP Server

by allegiant

mqscript_datetime_format

Format date and time variables in MQScript automation scripts using custom format strings for precise timestamp manipulation in mobile device control operations.

Instructions

Format date time with specified format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateTimeVariableYesDateTime variable name
formatNoTarget format stringyyyy-MM-dd
resultVariableNoVariable name to store resultformattedDate

Implementation Reference

  • The handler function that executes the tool: generates MQScript code `resultVariable = DateTime.Format(dateTimeVariable, format)` and returns a descriptive message.
    handler: async (args: { dateTimeVariable: string; format?: string; resultVariable?: string }) => { const { dateTimeVariable, format = 'yyyy-MM-dd', resultVariable = 'formattedDate' } = args; const script = `${resultVariable} = DateTime.Format(${dateTimeVariable}, "${format}")`; return { content: [ { type: 'text', text: `Generated MQScript DateTime format command:\n\`\`\`\n${script}\n\`\`\`\n\nThis formats "${dateTimeVariable}" to format "${format}".` } ] }; } },
  • Tool metadata including name, description, and input schema defining required dateTimeVariable and optional format/resultVariable.
    name: 'mqscript_datetime_format', description: 'Format date time with specified format', inputSchema: { type: 'object' as const, properties: { dateTimeVariable: { type: 'string', description: 'DateTime variable name' }, format: { type: 'string', description: 'Target format string', default: 'yyyy-MM-dd' }, resultVariable: { type: 'string', description: 'Variable name to store result', default: 'formattedDate' } }, required: ['dateTimeVariable'] },
  • src/index.ts:64-72 (registration)
    Registration for listing tools: returns the schema (name, desc, inputSchema) for all tools in ALL_TOOLS, including mqscript_datetime_format.
    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)
    Registration for calling tools: looks up tool by name in 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)}`); } });
  • src/index.ts:32-61 (registration)
    Central tool registry ALL_TOOLS spreads DateTimeCommands (source of mqscript_datetime_format tool definition).
    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