Skip to main content
Glama
JohanCodinha

nREPL MCP Server

by JohanCodinha

get_ns_vars

Retrieve all public variables, functions, and their metadata from a specified Clojure namespace to inspect code structure and current values.

Instructions

Get all public vars (functions, values) in a namespace with their metadata and current values. Example:

  • List main namespace vars: (get_ns_vars {:ns "main"}) Returns a map where keys are var names and values contain:

  • :meta - Metadata including :doc string, :line number, :file path

  • :value - Current value of the var

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nsYesNamespace to inspect

Implementation Reference

  • Handler for the 'get_ns_vars' tool. Validates the 'ns' argument, ensures an active nREPL connection, evaluates Clojure code to retrieve public vars from the specified namespace including their metadata and dereferenced values, and returns the result.
    case 'get_ns_vars': {
      await this.ensureNReplClient();
      const args = request.params.arguments;
      if (!args || typeof args.ns !== 'string') {
        throw new McpError(
          ErrorCode.InvalidParams,
          'ns parameter must be a string'
        );
      }
      const result = await this.nreplClient!.eval(
        `(into {} (for [[sym v] (ns-publics '${args.ns})] [sym {:meta (meta v) :value (deref v)}]))`
      );
      return {
        content: [{ type: 'text', text: result }],
      };
    }
  • src/index.ts:167-182 (registration)
    Registration of the 'get_ns_vars' tool in the ListTools response, including name, detailed description, and input schema definition.
      {
        name: 'get_ns_vars',
        description: 'Get all public vars (functions, values) in a namespace with their metadata and current values. Example:\n' +
          '- List main namespace vars: (get_ns_vars {:ns "main"})\n' +
          'Returns a map where keys are var names and values contain:\n' +
          '- :meta - Metadata including :doc string, :line number, :file path\n' +
          '- :value - Current value of the var',
        inputSchema: {
          type: 'object',
          properties: {
            ns: { type: 'string', description: 'Namespace to inspect' },
          },
          required: ['ns'],
        },
      },
    ],
  • Input schema for 'get_ns_vars' tool defining the required 'ns' parameter as a string.
    inputSchema: {
      type: 'object',
      properties: {
        ns: { type: 'string', description: 'Namespace to inspect' },
      },
      required: ['ns'],
    },
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 describes the return format (a map with keys as var names and values containing metadata and current values), which is helpful, but doesn't cover aspects like permissions needed, rate limits, error conditions, or whether it's a read-only operation (though 'Get' implies reading).

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 in the first sentence. The example and return format details are useful but could be slightly more streamlined. Overall, it's efficient with minimal waste.

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 (1 parameter, no output schema, no annotations), the description is somewhat complete but has gaps. It explains the return structure well, but lacks information on usage context, error handling, and behavioral traits like safety or performance considerations.

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%, so the schema already documents the single parameter 'ns' as 'Namespace to inspect'. The description adds an example usage with {:ns "main"} but doesn't provide additional semantic context beyond what the schema states, such as namespace format or scope limitations.

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 verb 'Get' and resource 'all public vars (functions, values) in a namespace with their metadata and current values', which is specific and comprehensive. It distinguishes from sibling tools (connect, eval_form) by focusing on namespace inspection rather than connection or evaluation operations.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It includes an example usage but doesn't mention prerequisites, constraints, or compare it to sibling tools like eval_form, which might also interact with namespace variables.

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