check_typescript
Identify and report TypeScript type errors in specified files to ensure code correctness during development.
Instructions
Check TypeScript files for type errors
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | TypeScript file paths to check |
Implementation Reference
- src/utils/linting-utils.ts:130-160 (handler)The core handler function that implements the TypeScript checking logic. Currently a simplified placeholder that returns no errors unless an exception occurs.async checkTypeScript(_filePath: string): Promise<{ errors: Array<{ line: number; column: number; message: string; code: string }>; valid: boolean; }> { // This is a simplified version. In production, we'd use TypeScript compiler API // For now, return basic validation try { // Basic TypeScript syntax checks const errors: Array<{ line: number; column: number; message: string; code: string }> = []; // This is a simplified version. In production, we'd use TypeScript compiler API // For now, return empty errors array return { errors, valid: errors.length === 0, }; } catch (error) { return { errors: [ { line: 1, column: 1, message: error instanceof Error ? error.message : 'Unknown error', code: 'UNKNOWN', }, ], valid: false, }; } }
- src/tools/linting.ts:41-55 (registration)Registers the 'check_typescript' tool in the lintingTools array, including name, description, and input schema.{ name: 'check_typescript', description: 'Check TypeScript files for type errors', inputSchema: { type: 'object', properties: { files: { type: 'array', items: { type: 'string' }, description: 'TypeScript file paths to check', }, }, required: ['files'], }, },
- src/tools/linting.ts:108-114 (handler)The dispatch handler in handleLintingTool that extracts input files and calls the checkTypeScript utility for each file.case 'check_typescript': { const files = params.files as string[]; const results = await Promise.all( files.map((file) => lintingUtils.checkTypeScript(file)) ); return results; }
- src/tools/linting.ts:2-3 (helper)Imports the LintingUtils class containing the checkTypeScript handler.import { LintingUtils } from '../utils/linting-utils.js'; import { Formatters } from '../utils/formatters.js';