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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "run_linter"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fix | No | Attempt to fix issues automatically | |
| files | No | Specific files to lint |
Implementation Reference
- src/tools/runLinter.ts:6-28 (handler)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(' '); } } - src/types/index.ts:54-57 (schema)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) ); - src/tools/runLinter.ts:32-34 (handler)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); }