Skip to main content
Glama

lint_code

Analyze code files with ESLint to identify syntax errors, enforce style guidelines, and improve code quality in development workflows.

Instructions

Lint code files using ESLint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesFile paths to lint

Implementation Reference

  • Handler logic for the 'lint_code' tool. Extracts file paths from input, calls LintingUtils.lintFiles to perform ESLint linting, and formats results using Formatters.
    case 'lint_code': { const files = params.files as string[]; const results = await lintingUtils.lintFiles(files); return Formatters.formatLintResults(results); }
  • Tool definition including name, description, and input schema for 'lint_code' tool, specifying array of file paths as required input.
    { name: 'lint_code', description: 'Lint code files using ESLint', inputSchema: { type: 'object', properties: { files: { type: 'array', items: { type: 'string' }, description: 'File paths to lint', }, }, required: ['files'], }, },
  • src/server.ts:18-25 (registration)
    Registration of lintingTools (containing lint_code) into the allTools array, which is returned in list tools response.
    const allTools = [ ...codeAnalysisTools, ...codeQualityTools, ...dependencyAnalysisTools, ...lintingTools, ...webScrapingTools, ...apiDiscoveryTools, ];
  • Core helper function that initializes ESLint, lints the given files, maps results to structured LintResult format including messages, counts, and fixes, with fallback for no config.
    async lintFiles(filePaths: string[]): Promise<LintResult[]> { try { const eslint = await this.getESLint(); const results = await eslint.lintFiles(filePaths); return results.map((result: any) => ({ file: result.filePath, messages: result.messages.map((msg: any) => ({ ruleId: msg.ruleId, severity: msg.severity as 0 | 1 | 2, message: msg.message, line: msg.line, column: msg.column, endLine: msg.endLine, endColumn: msg.endColumn, fix: msg.fix ? { range: [msg.fix.range[0], msg.fix.range[1]], text: msg.fix.text, } : undefined, })), errorCount: result.errorCount, warningCount: result.warningCount, fixableErrorCount: result.fixableErrorCount, fixableWarningCount: result.fixableWarningCount, })); } catch (error) { // If ESLint is not configured, return empty results if (error instanceof Error && error.message.includes('No ESLint configuration')) { return filePaths.map((file) => ({ file, messages: [], errorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0, })); } throw error; } }

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/code-alchemist01/development-tools-mcp-Server'

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