Skip to main content
Glama

run_linter

Analyze code for style and quality issues, with options to fix problems automatically or target specific files.

Instructions

Run standardized linter for the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fixNoAttempt to fix issues automatically
filesNoSpecific files to lint

Implementation Reference

  • RunLinterTool class extending BaseExecTool that implements the core logic for building and executing the linter command based on project configuration and provided options (fix, files).
    class RunLinterTool extends BaseExecTool<LinterOptions> { protected getActionName(): string { return 'Lint'; } protected async buildCommand(args: LinterOptions): Promise<string> { const { fix = false, files = [] } = args; const config = await loadProjectConfig(); const command = config.lintCommand ?? 'npm run lint'; const parts = [command]; if (fix && !command.includes('--fix')) { parts.push('--fix'); } if (files.length > 0) { parts.push(...files); } return parts.join(' '); } }
  • TypeScript interface defining the input schema for the run_linter tool, matching the Zod schema used in registration.
    export interface LinterOptions { fix?: boolean; files?: string[]; }
  • src/index.ts:82-93 (registration)
    Registers the 'run_linter' MCP tool with the server, including Zod inputSchema, description, and handler that delegates to runLinter function.
    // Register run_linter tool server.registerTool( 'run_linter', { description: 'Run standardized linter for the project', inputSchema: { fix: z.boolean().optional().default(false).describe('Attempt to fix issues automatically'), files: z.array(z.string()).optional().describe('Specific files to lint'), }, }, async (args) => runLinter(args) );
  • Exported runLinter function that instantiates RunLinterTool and executes it with the provided arguments, serving as the entry point called by the registration handler.
    export async function runLinter(args: LinterOptions): Promise<CallToolResult> { return tool.execute(args); }

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/jaggederest/mcp_reviewer'

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