generate_analysis_script
Create bash or PowerShell scripts to analyze .NET and Java projects for stateful code patterns, providing remediation guidance for stateless architecture migration.
Instructions
Generate a bash or PowerShell script for offline analysis
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scriptType | Yes | Type of script to generate |
Implementation Reference
- tools/generate-script.js:20-58 (handler)The handler function that implements the core logic of the 'generate_analysis_script' tool. It extracts the scriptType from input arguments, fetches the script content via apiClient, formats user instructions, and returns a formatted markdown response with the script.async execute(args) { try { const { scriptType } = args; // Call Statelessor API const scriptContent = await apiClient.generateScript(scriptType); // Format instructions const instructions = scriptType === 'bash' ? `To use this script: 1. Save as analyze.sh 2. Make executable: chmod +x analyze.sh 3. Run: ./analyze.sh /path/to/project 4. Results will be saved as findings.json` : `To use this script: 1. Save as analyze.ps1 2. Run: .\\analyze.ps1 -ProjectPath "C:\\path\\to\\project" 3. Results will be saved as findings.json`; return { content: [ { type: 'text', text: `# ${scriptType.toUpperCase()} Analysis Script\n\n${instructions}\n\n\`\`\`${scriptType}\n${scriptContent}\n\`\`\``, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error generating script: ${error.message}`, }, ], isError: true, }; } },
- tools/generate-script.js:4-18 (schema)The tool definition including name, description, and inputSchema for validation (scriptType: 'bash' or 'powershell').definition: { name: 'generate_analysis_script', description: 'Generate a bash or PowerShell script for offline analysis', inputSchema: { type: 'object', properties: { scriptType: { type: 'string', enum: ['bash', 'powershell'], description: 'Type of script to generate', }, }, required: ['scriptType'], }, },
- mcp-server.js:59-60 (registration)Registration in the MCP server switch statement: dispatches tool calls named 'generate_analysis_script' to the generateScriptTool.execute handler.case 'generate_analysis_script': return await generateScriptTool.execute(args);
- utils/api-client.js:83-98 (helper)Helper function in API client that makes HTTP GET request to Statelessor API to retrieve the raw script content for the specified scriptType.async generateScript(scriptType) { const requestId = this.generateRequestId(); try { const endpoint = scriptType === 'bash' ? '/api/script/bash' : '/api/script/powershell'; const response = await this.client.get(endpoint, { headers: { 'X-Request-ID': requestId, }, }); return response.data; } catch (error) { throw this.handleError(error, 'generateScript'); } }
- mcp-server.js:43-43 (registration)Tool definition registration in the ListToolsRequestSchema handler, exposing the schema to MCP clients.generateScriptTool.definition,