Skip to main content
Glama

get_ns_vars

Retrieve all public variables in a Clojure namespace, including metadata and current values, for inspection and debugging purposes. Supports namespace-specific querying via MCP server.

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

  • The handler function for the 'get_ns_vars' tool. It validates the namespace argument, ensures an nREPL connection, evaluates Clojure code to fetch public vars with metadata and values using ns-publics and deref, 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-181 (registration)
    Registers the 'get_ns_vars' tool in the ListTools response, including its name, detailed description with usage example, and input schema requiring a 'ns' string parameter.
    { 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'], }, },

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

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