mqscript_cjson_stringify
Convert MQScript object variables to JSON strings for data serialization and storage in mobile automation workflows.
Instructions
Convert object to JSON string
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| objectVariable | Yes | Object variable name to convert | |
| resultVariable | No | Variable name to store JSON string | jsonString |
Implementation Reference
- src/tools/plugin-commands.ts:57-68 (handler)The async handler function for the 'mqscript_cjson_stringify' tool. It generates an MQScript command to stringify a JSON object into a string and stores it in the specified variable.handler: async (args: { objectVariable: string; resultVariable?: string }) => { const { objectVariable, resultVariable = 'jsonString' } = args; const script = `${resultVariable} = CJson.Stringify(${objectVariable})`; return { content: [ { type: 'text', text: `Generated MQScript CJson stringify command:\n\`\`\`\n${script}\n\`\`\`\n\nThis converts object "${objectVariable}" to JSON string in "${resultVariable}".` } ] }; }
- src/tools/plugin-commands.ts:42-56 (schema)The input schema for the tool, defining required 'objectVariable' and optional 'resultVariable'.inputSchema: { type: 'object' as const, properties: { objectVariable: { type: 'string', description: 'Object variable name to convert' }, resultVariable: { type: 'string', description: 'Variable name to store JSON string', default: 'jsonString' } }, required: ['objectVariable'] },
- src/index.ts:56-60 (registration)Registration of CJsonCommands (containing mqscript_cjson_stringify) by spreading into the ALL_TOOLS object used by the MCP server for tool listing and execution.// Plugin Commands - 插件命令 ...CJsonCommands, ...DateTimeCommands, ...FileCommands, ...TuringCommands,
- src/index.ts:16-16 (registration)Import of CJsonCommands from plugin-commands.ts, which defines the mqscript_cjson_stringify tool.import { CJsonCommands, DateTimeCommands, FileCommands, TuringCommands } from './tools/plugin-commands.js';