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
| Name | Required | Description | Default |
|---|---|---|---|
| ns | Yes | Namespace to inspect |
Implementation Reference
- src/index.ts:237-252 (handler)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'], }, }, ],
- src/index.ts:174-180 (schema)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'], },