Skip to main content
Glama

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'], },

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