Skip to main content
Glama
allegiant

MQScript MCP Server

by allegiant

mqscript_cjson_parse

Parse JSON strings into structured objects for use in mobile automation scripts, enabling data handling and manipulation during device control operations.

Instructions

Parse JSON string to object

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsonStringYesJSON string to parse
resultVariableNoVariable name to store parsed objectjsonObj

Implementation Reference

  • The handler function that executes the tool logic: generates MQScript to parse JSON string into a variable.
    handler: async (args: { jsonString: string; resultVariable?: string }) => {
      const { jsonString, resultVariable = 'jsonObj' } = args;
      const script = `${resultVariable} = CJson.Parse("${jsonString}")`;
      return {
        content: [
          {
            type: 'text',
            text: `Generated MQScript CJson parse command:\n\`\`\`\n${script}\n\`\`\`\n\nThis parses JSON string and stores result in "${resultVariable}".`
          }
        ]
      };
    }
  • Input schema defining parameters for the tool.
    inputSchema: {
      type: 'object' as const,
      properties: {
        jsonString: {
          type: 'string',
          description: 'JSON string to parse'
        },
        resultVariable: {
          type: 'string',
          description: 'Variable name to store parsed object',
          default: 'jsonObj'
        }
      },
      required: ['jsonString']
    },
  • The complete tool definition object for mqscript_cjson_parse, which is spread into the ALL_TOOLS registry in src/index.ts.
    parse: {
      name: 'mqscript_cjson_parse',
      description: 'Parse JSON string to object',
      inputSchema: {
        type: 'object' as const,
        properties: {
          jsonString: {
            type: 'string',
            description: 'JSON string to parse'
          },
          resultVariable: {
            type: 'string',
            description: 'Variable name to store parsed object',
            default: 'jsonObj'
          }
        },
        required: ['jsonString']
      },
      handler: async (args: { jsonString: string; resultVariable?: string }) => {
        const { jsonString, resultVariable = 'jsonObj' } = args;
        const script = `${resultVariable} = CJson.Parse("${jsonString}")`;
        return {
          content: [
            {
              type: 'text',
              text: `Generated MQScript CJson parse command:\n\`\`\`\n${script}\n\`\`\`\n\nThis parses JSON string and stores result in "${resultVariable}".`
            }
          ]
        };
      }
    },
  • src/index.ts:32-61 (registration)
    Registration of all tools including CJsonCommands (containing mqscript_cjson_parse) into the ALL_TOOLS object used by MCP server handlers.
    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 action ('parse') but doesn't describe key traits: error handling (e.g., what happens with invalid JSON), side effects (e.g., whether it modifies state), performance (e.g., speed or memory usage), or output format (e.g., the type of object returned). This leaves significant gaps for a tool that processes data.

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 with zero waste—'Parse JSON string to object' is front-loaded and directly conveys the core action. It's appropriately sized for a simple tool, avoiding unnecessary elaboration while staying focused on the task.

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 complexity (a data parsing tool with no annotations and no output schema), the description is incomplete. It doesn't explain the return value (what 'object' entails), error cases, or how it fits into the broader context of JSON handling with sibling tools. For a tool that transforms data, more detail is needed to ensure correct usage by an 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 ('jsonString' and 'resultVariable'). The description adds no meaning beyond this—it doesn't explain parameter interactions, default usage, or examples. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but there's no extra value from the description.

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 'Parse JSON string to object' clearly states the verb ('parse') and resource ('JSON string'), but it's vague about the exact purpose—it doesn't specify what 'object' means in this context (e.g., a data structure for further manipulation) or how it differs from sibling tools like 'mqscript_cjson_stringify' (which likely does the reverse). It avoids tautology by not just restating the name, but lacks specificity for full 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios like converting JSON data for processing, prerequisites (e.g., valid JSON input), or exclusions (e.g., not for binary data). With siblings like 'mqscript_cjson_get' and 'mqscript_cjson_set' that handle JSON objects, there's no explicit comparison to help an agent choose correctly.

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