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

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] current date and time,' implying a read-only operation, but does not specify whether it returns a string, object, or other format, nor does it mention any side effects, permissions, or performance considerations. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence ('Get current date and time') that is front-loaded and wastes no words. It directly conveys the core purpose without unnecessary elaboration, making it highly concise and well-structured for its simplicity.

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

Completeness3/5

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

Given the tool's low complexity (no annotations, no output schema, but 100% schema coverage), the description is minimally adequate. It states what the tool does but lacks details on output format, error handling, or integration with sibling tools. Without an output schema, the description should ideally hint at the return type, but it does not, leaving some contextual gaps for the agent.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('format' and 'resultVariable'). The description does not add any meaning beyond what the schema provides—it does not explain parameter usage, default values, or examples. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema adequately handles parameter semantics without extra description.

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

Purpose4/5

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

The description 'Get current date and time' clearly states the tool's function with a specific verb ('Get') and resource ('current date and time'). It distinguishes from siblings like 'mqscript_datetime_adddays' or 'mqscript_datetime_format' by focusing on the current moment rather than manipulation or formatting of existing dates. However, it doesn't explicitly mention the optional formatting parameter, which slightly limits differentiation.

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. The description does not mention sibling tools like 'mqscript_sys_gettime' (which might serve a similar purpose) or clarify scenarios where this tool is preferred over others. There is no context about prerequisites, dependencies, or typical use cases.

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