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,
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but discloses minimal behavioral traits. It implies a read-only transformation (formatting), but doesn't specify if it modifies the original variable, creates a new one, handles errors (e.g., invalid formats), or has side effects. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it appropriately sized. However, it's not optimally front-loaded with critical details (e.g., it could start with 'Format an existing date/time variable...'), and the brevity contributes to vagueness rather than clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is incomplete. It lacks information on return values (e.g., where the formatted result is stored), error handling, and practical usage examples. Without annotations or output schema, the description should compensate more to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (dateTimeVariable, format, resultVariable) with clear descriptions. The description adds no additional meaning beyond the schema, such as format examples (e.g., 'yyyy-MM-dd' vs 'MM/dd/yyyy'), variable naming conventions, or default behavior nuances. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Format date time with specified format' states the basic action (formatting) and resource (date time), but it's vague about scope and lacks sibling differentiation. It doesn't specify whether this formats existing variables, system time, or other sources, nor does it distinguish from siblings like 'mqscript_datetime_adddays' or 'mqscript_datetime_now' beyond the core formatting concept.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a pre-existing date/time variable), exclusions, or comparisons to similar tools like 'mqscript_datetime_compare' or 'mqscript_sys_gettime'. The description offers only the basic function without context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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