Skip to main content
Glama

pursIdeRebuild

Recompile a single PureScript module to check for errors, providing immediate feedback during code editing. Requires IDE server and loaded modules, faster than full project rebuild.

Instructions

Quickly recompile a single PureScript module and check for errors. PREREQUISITES: IDE server running and modules loaded. Much faster than full project rebuild. Use when editing code to get immediate feedback.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actualFileNoOptional: Real path if 'file' is 'data:' or a temp file.
codegenNoOptional: Codegen targets (e.g., 'js', 'corefn'). Defaults to ['js'].
fileYesPath to the module to rebuild, or 'data:' prefixed source code.

Implementation Reference

  • Handler function that executes the pursIdeRebuild tool. It validates the input arguments, constructs the parameters for the 'rebuild' command, sends it to the purs ide server using sendCommandToPursIde, and returns the MCP-formatted response with the result.
    "pursIdeRebuild": async (args) => {
        if (!args || typeof args.file !== 'string') {
            throw new Error("Invalid input: 'file' (string) is required for pursIdeRebuild.");
        }
        const params = {
            file: args.file,
            actualFile: args.actualFile,
            codegen: args.codegen // purs ide server defaults to js if undefined
        };
        const result = await sendCommandToPursIde({ command: "rebuild", params });
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    },
  • Input schema defining the parameters for the pursIdeRebuild tool: requires 'file' (string), optional 'actualFile' and 'codegen' (array of strings).
    inputSchema: {
        type: "object",
        properties: {
            file: { type: "string", description: "Path to the module to rebuild, or 'data:' prefixed source code." },
            actualFile: { type: "string", description: "Optional: Real path if 'file' is 'data:' or a temp file." },
            codegen: { type: "array", items: { type: "string" }, description: "Optional: Codegen targets (e.g., 'js', 'corefn'). Defaults to ['js']." }
        },
        required: ["file"],
        additionalProperties: false
    }
  • index.js:744-757 (registration)
    Registration of the pursIdeRebuild tool in the TOOL_DEFINITIONS array, which is returned by the tools/list MCP method. Includes name, description, and input schema.
    {
        name: "pursIdeRebuild",
        description: "Quickly recompile a single PureScript module and check for errors. PREREQUISITES: IDE server running and modules loaded. Much faster than full project rebuild. Use when editing code to get immediate feedback.",
        inputSchema: {
            type: "object",
            properties: {
                file: { type: "string", description: "Path to the module to rebuild, or 'data:' prefixed source code." },
                actualFile: { type: "string", description: "Optional: Real path if 'file' is 'data:' or a temp file." },
                codegen: { type: "array", items: { type: "string" }, description: "Optional: Codegen targets (e.g., 'js', 'corefn'). Defaults to ['js']." }
            },
            required: ["file"],
            additionalProperties: false
        }
    },
  • Helper function sendCommandToPursIde used by the handler to communicate the 'rebuild' command over TCP to the running purs ide server and retrieve the response.
    function sendCommandToPursIde(commandPayload) {
        return new Promise((resolve, reject) => {
            if (!pursIdeProcess || !pursIdeIsReady || !pursIdeServerPort) {
                return reject(new Error("purs ide server is not running or not ready."));
            }
            const client = new net.Socket();
            let responseData = '';
            client.connect(pursIdeServerPort, '127.0.0.1', () => {
                logToStderr(`[MCP Client->purs ide]: Sending command: ${JSON.stringify(commandPayload).substring(0,100)}...`, 'debug');
                client.write(JSON.stringify(commandPayload) + '\n');
            });
            client.on('data', (data) => {
                responseData += data.toString();
                if (responseData.includes('\n')) {
                     const completeResponses = responseData.split('\n').filter(Boolean);
                     responseData = ''; 
                     if (completeResponses.length > 0) {
                        try {
                            resolve(JSON.parse(completeResponses[0].trim()));
                        } catch (e) {
                            reject(new Error(`Failed to parse JSON response from purs ide: ${e.message}. Raw: ${completeResponses[0]}`));
                        }
                     }
                     client.end(); 
                }
            });
            client.on('end', () => {
                if (responseData.trim()) {
                     try { resolve(JSON.parse(responseData.trim())); } 
                     catch (e) { reject(new Error(`Failed to parse JSON response from purs ide on end: ${e.message}. Raw: ${responseData}`));}
                }
            });
            client.on('close', () => { logToStderr(`[MCP Client->purs ide]: Connection closed.`, 'debug'); });
            client.on('error', (err) => reject(new Error(`TCP connection error with purs ide server: ${err.message}`)));
        });
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's purpose and speed advantage, but lacks details on error handling, output format, or potential side effects (e.g., whether it modifies files or only reports errors). The mention of prerequisites adds some context, but more behavioral traits would enhance transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with three sentences: the first states the core purpose, the second lists prerequisites, and the third provides usage context and comparison. Every sentence adds value without redundancy, making it front-loaded and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is mostly complete. It covers purpose, prerequisites, and usage context well, but lacks details on return values or error behavior. Since there's no output schema, some additional information about what the tool returns would improve completeness, though the current description is sufficient for basic understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing complete parameter documentation. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain 'data:' format details or codegen options further). This meets the baseline score of 3 since the schema adequately covers parameter meanings.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('recompile a single PureScript module and check for errors'), identifies the resource ('PureScript module'), and distinguishes it from sibling tools by emphasizing speed ('Much faster than full project rebuild') and context ('when editing code to get immediate feedback'). This provides precise differentiation from tools like 'pursIdeLoad' or 'start_purs_ide_server'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('Use when editing code to get immediate feedback'), provides prerequisites ('IDE server running and modules loaded'), and contrasts it with alternatives ('Much faster than full project rebuild'), giving clear guidance on its appropriate context versus other rebuild or IDE operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related 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/avi892nash/purescript-mcp-tools'

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