mqscript_file_exists
Check if a file exists at a specified path to verify file availability before performing mobile automation operations.
Instructions
Check if file exists
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | File path to check | |
| resultVariable | No | Variable name to store result | fileExists |
Implementation Reference
- src/tools/plugin-commands.ts:397-408 (handler)The handler function that implements the mqscript_file_exists tool logic by generating an MQScript command to check file existence and formatting the response.handler: async (args: { filePath: string; resultVariable?: string }) => { const { filePath, resultVariable = 'fileExists' } = args; const script = `${resultVariable} = File.Exists("${filePath}")`; return { content: [ { type: 'text', text: `Generated MQScript file exists command:\n\`\`\`\n${script}\n\`\`\`\n\nThis checks if file "${filePath}" exists and stores result in "${resultVariable}".` } ] }; }
- src/tools/plugin-commands.ts:382-396 (schema)Input schema defining parameters for the mqscript_file_exists tool: filePath (required) and optional resultVariable.inputSchema: { type: 'object' as const, properties: { filePath: { type: 'string', description: 'File path to check' }, resultVariable: { type: 'string', description: 'Variable name to store result', default: 'fileExists' } }, required: ['filePath'] },
- src/tools/plugin-commands.ts:379-409 (registration)Registration of the mqscript_file_exists tool as part of FileCommands export, including name, description, schema, and handler.exists: { name: 'mqscript_file_exists', description: 'Check if file exists', inputSchema: { type: 'object' as const, properties: { filePath: { type: 'string', description: 'File path to check' }, resultVariable: { type: 'string', description: 'Variable name to store result', default: 'fileExists' } }, required: ['filePath'] }, handler: async (args: { filePath: string; resultVariable?: string }) => { const { filePath, resultVariable = 'fileExists' } = args; const script = `${resultVariable} = File.Exists("${filePath}")`; return { content: [ { type: 'text', text: `Generated MQScript file exists command:\n\`\`\`\n${script}\n\`\`\`\n\nThis checks if file "${filePath}" exists and stores result in "${resultVariable}".` } ] }; } },