Skip to main content
Glama
JohanCodinha

nREPL MCP Server

by JohanCodinha

connect

Establish a connection to an nREPL server by specifying host and port parameters to enable Clojure code evaluation and namespace inspection.

Instructions

Connect to an nREPL server. Example: (connect {:host "localhost" :port 1234})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYesnREPL server host
portYesnREPL server port

Implementation Reference

  • Handler for the 'connect' tool: validates input arguments, closes existing connection if any, initializes a new NReplClient with the provided host and port, clones a session, and returns a success message.
    case 'connect': {
      const args = request.params.arguments;
      if (!args || typeof args.host !== 'string' || typeof args.port !== 'number') {
        throw new McpError(
          ErrorCode.InvalidParams,
          'host and port parameters are required'
        );
      }
    
      // Close existing connection if any
      if (this.nreplClient) {
        await this.nreplClient.close();
        this.nreplClient = null;
      }
    
      this.host = args.host;
      this.port = args.port;
      this.nreplClient = new NReplClient(this.port);
      await this.nreplClient.clone(); // Create initial session
    
      return {
        content: [{ type: 'text', text: `Connected to nREPL server at ${this.host}:${this.port}` }],
      };
    }
  • Input schema definition for the 'connect' tool, specifying host as string and port as number, both required.
    inputSchema: {
      type: 'object',
      properties: {
        host: { type: 'string', description: 'nREPL server host' },
        port: { type: 'number', description: 'nREPL server port' }
      },
      required: ['host', 'port']
  • src/index.ts:140-151 (registration)
    Registration of the 'connect' tool in the ListToolsRequestSchema response, including name, description, and input schema.
      name: 'connect',
      description: 'Connect to an nREPL server.\n' +
        'Example: (connect {:host "localhost" :port 1234})',
      inputSchema: {
        type: 'object',
        properties: {
          host: { type: 'string', description: 'nREPL server host' },
          port: { type: 'number', description: 'nREPL server port' }
        },
        required: ['host', 'port']
      }
    },
Behavior2/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 states the action ('Connect') but does not disclose behavioral traits such as whether this is a one-time or persistent connection, error handling, authentication needs, or what happens upon successful connection. The example adds minimal context but leaves key operational details unspecified.

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 extremely concise and front-loaded, with the first sentence stating the purpose clearly and the second providing a practical example. Every sentence earns its place by reinforcing understanding without unnecessary elaboration.

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

Completeness2/5

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

Given the complexity of a connection tool with no annotations and no output schema, the description is incomplete. It lacks information about what the tool returns upon success or failure, connection persistence, or error conditions, which are critical for an agent to use it effectively in a workflow.

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 schema description coverage is 100%, with both parameters ('host' and 'port') well-documented in the schema. The description adds an example that illustrates parameter usage but does not provide additional semantic meaning beyond what the schema already specifies, such as format constraints or default values.

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 ('Connect to') and target resource ('an nREPL server'), with an example that reinforces the purpose. It distinguishes itself from sibling tools like 'eval_form' and 'get_ns_vars' by focusing on establishing a connection rather than evaluating code or retrieving namespace variables.

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

Usage Guidelines3/5

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

The description implies usage when needing to establish a connection to an nREPL server, but it does not provide explicit guidance on when to use this tool versus alternatives or any prerequisites. The example suggests typical usage scenarios but lacks context about timing or dependencies.

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

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/JohanCodinha/nrepl-mcp-server'

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