Skip to main content
Glama
allegiant

MQScript MCP Server

by allegiant

mqscript_file_write

Write content to files using specified encoding and append options for mobile automation script operations.

Instructions

Write content to file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appendNoAppend to file instead of overwrite
contentYesContent to write
encodingNoFile encodingUTF-8
filePathYesFile path to write

Implementation Reference

  • The handler function that implements the tool logic by generating MQScript code for writing to a file.
    handler: async (args: { filePath: string; content: string; encoding?: string; append?: boolean }) => {
      const { filePath, content, encoding = 'UTF-8', append = false } = args;
      const script = `File.Write("${filePath}", "${content}", "${encoding}", ${append})`;
      return {
        content: [
          {
            type: 'text',
            text: `Generated MQScript file write command:\n\`\`\`\n${script}\n\`\`\`\n\nThis writes content to file "${filePath}" with encoding "${encoding}", append=${append}.`
          }
        ]
      };
    }
  • The input schema defining the parameters for the mqscript_file_write tool.
    inputSchema: {
      type: 'object' as const,
      properties: {
        filePath: {
          type: 'string',
          description: 'File path to write'
        },
        content: {
          type: 'string',
          description: 'Content to write'
        },
        encoding: {
          type: 'string',
          description: 'File encoding',
          enum: ['UTF-8', 'GBK', 'ASCII'],
          default: 'UTF-8'
        },
        append: {
          type: 'boolean',
          description: 'Append to file instead of overwrite',
          default: false
        }
      },
      required: ['filePath', 'content']
    },
  • src/index.ts:57-61 (registration)
    Registration of FileCommands (containing mqscript_file_write) into the ALL_TOOLS registry used by MCP server handlers.
      ...CJsonCommands,
      ...DateTimeCommands,
      ...FileCommands,
      ...TuringCommands,
    };
  • src/index.ts:64-72 (registration)
    MCP ListTools handler that lists all registered tools including mqscript_file_write.
    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)
    MCP CallTool handler that executes the tool handler for mqscript_file_write when called.
    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?

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose behavioral traits like whether it creates files if they don't exist, overwrites by default, requires permissions, handles errors, or has side effects. This is inadequate for a file-writing tool with mutation implications.

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. It's front-loaded and appropriately sized for its purpose, though it could benefit from more detail given the tool's complexity.

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?

For a file-writing tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects like file creation, error handling, or return values, leaving significant gaps in understanding how to use it effectively.

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 fully documents all parameters (filePath, content, append, encoding). The description adds no meaning beyond what the schema provides, as it doesn't explain parameter interactions or usage nuances. Baseline 3 is appropriate given high schema coverage.

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 'Write content to file' clearly states the verb ('Write') and resource ('content to file'), but it's vague about scope and doesn't differentiate from sibling tools like 'mqscript_file_copy' or 'mqscript_file_read'. It doesn't specify whether this creates new files or modifies existing ones, making it less specific than ideal.

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 like 'mqscript_file_copy' or 'mqscript_file_read'. The description lacks context about prerequisites (e.g., file existence), exclusions, or comparison to siblings, leaving usage entirely implicit.

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