Skip to main content
Glama

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
NameRequiredDescriptionDefault
scriptTypeYesType of script to generate

Implementation Reference

  • 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, }; } },
  • 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);
  • 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,

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/aloksinghGIT/statelessor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server