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)}`); } });

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