Skip to main content
Glama
Bigsy

clj-kondo MCP Server

lint_clojure

Analyze and identify errors or warnings in Clojure, ClojureScript, and EDN files using clj-kondo. Supports file paths, directories, or classpaths, with customizable linting levels and configurations.

Instructions

Lint Clojure/ClojureScript/EDN content using clj-kondo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configDirNoOptional absolute path to .clj-kondo config directory (e.g. /Users/name/project/.clj-kondo). If not provided, clj-kondo will look for .clj-kondo directory in the current and parent directories.
fileYesCan be: 1) Absolute path to a file, 2) Directory path (will lint all .clj/.cljs/.cljc files recursively), or 3) Classpath string (obtained via `lein classpath` or `clojure -Spath`)
levelNoOptional linting level. By default all lints are errors. Set to "warning" to use warning level instead.

Implementation Reference

  • CallToolRequestSchema handler that dispatches to lint_clojure tool by validating arguments and executing clj-kondo CLI.
    this.server.setRequestHandler(CallToolRequestSchema, async (request: Request) => {
      if (!request.params || request.params.name !== 'lint_clojure') {
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unknown tool: ${request.params?.name || 'undefined'}`
        );
      }
    
      if (!request.params.arguments || !isValidLintArgs(request.params.arguments)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid lint arguments'
        );
      }
    
      try {
        const configDirArg = request.params.arguments.configDir
          ? `--config-dir "${request.params.arguments.configDir}"`
          : '';
        const levelArg = request.params.arguments.level === 'warning'
          ? '--fail-level error'
          : '--fail-level warning';
        const { stdout, stderr } = await execAsync(
          `clj-kondo --lint "${request.params.arguments.file}" ${configDirArg} ${levelArg} --parallel`
        );
    
        return {
          content: [
            {
              type: 'text',
              text: stdout || stderr,
            },
          ],
        };
      } catch (error: any) {
        // clj-kondo returns non-zero exit code when it finds linting issues
        if (error.stdout || error.stderr) {
          return {
            content: [
              {
                type: 'text',
                text: error.stdout || error.stderr,
              },
            ],
          };
        }
        throw error;
      }
    });
  • Input schema definition for the lint_clojure tool.
    inputSchema: {
      type: 'object',
      properties: {
        file: {
          type: 'string',
          description: 'Can be: 1) Absolute path to a file, 2) Directory path (will lint all .clj/.cljs/.cljc files recursively), or 3) Classpath string (obtained via `lein classpath` or `clojure -Spath`)',
        },
        configDir: {
          type: 'string',
          description: 'Optional absolute path to .clj-kondo config directory (e.g. /Users/name/project/.clj-kondo). If not provided, clj-kondo will look for .clj-kondo directory in the current and parent directories.',
        },
        level: {
          type: 'string',
          enum: ['warning'],
          description: 'Optional linting level. By default all lints are errors. Set to "warning" to use warning level instead.',
        }
      },
      required: ['file'],
    },
  • src/index.ts:53-75 (registration)
    Tool registration in the ListToolsRequestSchema handler.
    {
      name: 'lint_clojure',
      description: 'Lint Clojure/ClojureScript/EDN content using clj-kondo',
      inputSchema: {
        type: 'object',
        properties: {
          file: {
            type: 'string',
            description: 'Can be: 1) Absolute path to a file, 2) Directory path (will lint all .clj/.cljs/.cljc files recursively), or 3) Classpath string (obtained via `lein classpath` or `clojure -Spath`)',
          },
          configDir: {
            type: 'string',
            description: 'Optional absolute path to .clj-kondo config directory (e.g. /Users/name/project/.clj-kondo). If not provided, clj-kondo will look for .clj-kondo directory in the current and parent directories.',
          },
          level: {
            type: 'string',
            enum: ['warning'],
            description: 'Optional linting level. By default all lints are errors. Set to "warning" to use warning level instead.',
          }
        },
        required: ['file'],
      },
    },
  • Helper function to validate input arguments for lint_clojure.
    const isValidLintArgs = (
      args: any
    ): args is { file: string; configDir?: string; level?: 'warning' } =>
      typeof args === 'object' &&
      args !== null &&
      typeof args.file === 'string' &&
      (args.configDir === undefined || typeof args.configDir === 'string') &&
      (args.level === undefined || args.level === 'warning');
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 specifies what gets processed (Clojure/ClojureScript/EDN content) and the tool used, but doesn't describe output format, error handling, performance characteristics, or what constitutes successful linting. The description adds some value but leaves significant behavioral aspects undocumented.

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 a single, efficient sentence that communicates the essential purpose without any wasted words. It's front-loaded with the core functionality and uses precise terminology. Every element of the description earns its place by adding meaningful information.

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 no annotations, no output schema, and 3 parameters with good schema coverage, the description provides adequate basic context but leaves gaps. It explains what the tool does but doesn't describe what users can expect as results, how to interpret linting output, or any limitations of the clj-kondo approach. For a tool with no structured output documentation, more guidance would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description adds value by providing context about what 'lint' means in this context and specifying the exact tool being used (clj-kondo), which helps users understand the linting approach and standards being applied beyond what the parameter descriptions provide.

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 tool's purpose with specific verb ('lint') and target resources ('Clojure/ClojureScript/EDN content'), and specifies the implementation method ('using clj-kondo'). It distinguishes itself by naming the exact linter being used, which is helpful even without sibling tools for comparison.

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 provides implied usage context by specifying what types of content can be linted and the tool being used, but offers no explicit guidance on when to use this tool versus alternatives (though no sibling tools exist). It doesn't mention prerequisites, typical workflows, or integration scenarios.

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

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/Bigsy/clj-kondo-MCP'

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