Skip to main content
Glama

pursIdeList

Retrieve available modules or import lists in a PureScript project to analyze structure and dependencies. Requires IDE server running with modules loaded.

Instructions

List available modules in the project or imports in a specific file. PREREQUISITES: IDE server running and modules loaded. Helps understand project structure and dependencies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoPath to the .purs file (required for 'import' listType).
listTypeYesType of list to retrieve.

Implementation Reference

  • The handler function that implements the core logic for the 'pursIdeList' MCP tool. Validates input (listType required, file for 'import'), forwards to purs ide server via 'list' command, and formats the response.
    "pursIdeList": async (args) => {
        if (!args || typeof args.listType !== 'string') {
            throw new Error("Invalid input: 'listType' (string) is required for pursIdeList.");
        }
        const params = { type: args.listType };
        if (args.listType === "import") {
            if (typeof args.file !== 'string') {
                throw new Error("'file' (string) is required when listType is 'import'.");
            }
            params.file = args.file;
        }
        const result = await sendCommandToPursIde({ command: "list", params });
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Input schema defining the parameters for the 'pursIdeList' tool: listType (availableModules or import) and optional file path for import listing.
    {
        name: "pursIdeList",
        description: "List available modules in the project or imports in a specific file. PREREQUISITES: IDE server running and modules loaded. Helps understand project structure and dependencies.",
        inputSchema: {
            type: "object",
            properties: {
                listType: { type: "string", enum: ["availableModules", "import"], description: "Type of list to retrieve." },
                file: { type: "string", description: "Path to the .purs file (required for 'import' listType)." }
            },
            required: ["listType"],
            additionalProperties: false
        }
    }
  • index.js:1113-1126 (registration)
    Registration of the 'pursIdeList' handler in the INTERNAL_TOOL_HANDLERS object, mapping the tool name to its execution function.
    "pursIdeList": async (args) => {
        if (!args || typeof args.listType !== 'string') {
            throw new Error("Invalid input: 'listType' (string) is required for pursIdeList.");
        }
        const params = { type: args.listType };
        if (args.listType === "import") {
            if (typeof args.file !== 'string') {
                throw new Error("'file' (string) is required when listType is 'import'.");
            }
            params.file = args.file;
        }
        const result = await sendCommandToPursIde({ command: "list", params });
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • index.js:772-784 (registration)
    Registration of the 'pursIdeList' tool in the TOOL_DEFINITIONS array, used by the tools/list MCP method to advertise available tools and their schemas.
    {
        name: "pursIdeList",
        description: "List available modules in the project or imports in a specific file. PREREQUISITES: IDE server running and modules loaded. Helps understand project structure and dependencies.",
        inputSchema: {
            type: "object",
            properties: {
                listType: { type: "string", enum: ["availableModules", "import"], description: "Type of list to retrieve." },
                file: { type: "string", description: "Path to the .purs file (required for 'import' listType)." }
            },
            required: ["listType"],
            additionalProperties: false
        }
    }
  • Shared helper function used by pursIdeList (and other pursIde* tools) to send JSON commands to the running purs ide TCP server and receive/parse responses.
    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}`)));
        });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions prerequisites ('IDE server running and modules loaded') and a high-level benefit ('Helps understand project structure and dependencies'), but it lacks details on behavioral traits such as error handling, performance characteristics, or what the output looks like (e.g., format, pagination). For a tool with no annotations, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the core purpose stated first, followed by prerequisites and a benefit. It uses three concise sentences without unnecessary fluff, making it efficient. However, it could be slightly more structured by explicitly separating usage guidelines from the purpose, preventing a perfect score.

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

Completeness3/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 (2 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It covers the purpose and prerequisites but lacks details on output format, error cases, or how it interacts with sibling tools. Without an output schema, the description should ideally explain return values, which it doesn't, making it minimally viable but incomplete.

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?

The input schema has 100% description coverage, providing clear details for both parameters ('file' and 'listType'). The description adds minimal value beyond the schema, only implying the parameter usage in the opening sentence. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'List available modules in the project or imports in a specific file.' It specifies the verb ('List') and resources ('modules' or 'imports'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'getImports' or 'getModuleName', which offer similar functionality, keeping it from a perfect score.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool: 'PREREQUISITES: IDE server running and modules loaded.' It also implies usage based on the 'listType' parameter (e.g., 'availableModules' vs. 'import'), but it doesn't explicitly state when to choose this tool over alternatives like 'getImports' or 'getModuleName', or specify exclusions, so it's not a full 5.

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