Skip to main content
Glama
allegiant

MQScript MCP Server

by allegiant

mqscript_cstr

Convert values to strings for use in MQScript mobile automation, enabling proper data handling in device control operations.

Instructions

Convert value to string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultVariableNoVariable name to store resultresult
valueYesValue to convert to string

Implementation Reference

  • The main handler function for the 'mqscript_cstr' tool. It generates MQScript code that converts a given value to a string using the CStr function and returns a formatted response.
    handler: async (args: { value: string; resultVariable?: string }) => {
      const { value, resultVariable = 'result' } = args;
      const script = `${resultVariable} = CStr(${value})`;
      return {
        content: [
          {
            type: 'text',
            text: `Generated MQScript string conversion:\n\`\`\`\n${script}\n\`\`\`\n\nThis converts ${value} to string.`
          }
        ]
      };
    }
  • The input schema for the 'mqscript_cstr' tool, defining the expected arguments: a required 'value' string and an optional 'resultVariable'.
    inputSchema: {
      type: 'object' as const,
      properties: {
        value: {
          type: 'string',
          description: 'Value to convert to string'
        },
        resultVariable: {
          type: 'string',
          description: 'Variable name to store result',
          default: 'result'
        }
      },
      required: ['value']
    },
  • src/index.ts:32-61 (registration)
    The ALL_TOOLS registry that spreads in TypeConversionFunctions (containing mqscript_cstr) from standard-library.ts, making it available for MCP tool listing and execution.
    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,
    };
  • src/index.ts:75-88 (registration)
    The MCP server request handler for CallToolRequestSchema. It locates the tool by name from ALL_TOOLS and invokes its handler function, effectively registering mqscript_cstr for execution.
    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)}`);
      }
    });
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. 'Convert value to string' implies a transformation operation but doesn't specify details like error handling (e.g., what happens if conversion fails), side effects, or performance characteristics. It lacks context on what 'value' means (e.g., input types, conversion rules) beyond the schema, leaving behavioral traits unclear.

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 ('Convert value to string') that is front-loaded and wastes no words. It directly conveys the core function without unnecessary elaboration, making it appropriately sized for a simple conversion tool.

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 complexity (a conversion function with 2 parameters, no annotations, and no output schema), the description is incomplete. It doesn't explain the return value or storage mechanism (implied by 'resultVariable'), lacks error handling or input constraints, and doesn't differentiate from siblings. For a tool with no output schema and minimal annotations, more context is needed to be fully helpful.

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 'value' described as 'Value to convert to string' and 'resultVariable' as 'Variable name to store result'. The description 'Convert value to string' adds minimal meaning beyond the schema, as it essentially restates the 'value' parameter's purpose. With high schema coverage, the baseline is 3, and the description doesn't significantly enhance parameter understanding.

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 'Convert value to string' clearly states the action (convert) and target (value to string), which is a specific verb+resource. However, it doesn't distinguish this tool from its many siblings (like mqscript_cbool, mqscript_cint, etc.), which appear to be other conversion or utility functions. The purpose is understandable but lacks sibling 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. With siblings like mqscript_cbool (convert to boolean) and mqscript_cint (convert to integer), it's unclear when string conversion is preferred or what context it applies to (e.g., data formatting, output preparation). No explicit when/when-not or alternative mentions are present.

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