dart-analyze
Analyze Dart code for errors and warnings by running the Dart analyzer on specified files or directories to identify issues and improve code quality.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Directory or file to analyze | |
| options | No | Additional options for the dart analyze command |
Implementation Reference
- src/tools/analyze.ts:10-25 (handler)The main handler function for the 'dart-analyze' tool. It executes the 'dart analyze' command with provided path and options, returning the output or error.export async function analyze(args: z.infer<typeof analyzeSchema>) { const { path, options = [] } = args; // Convert relative path to absolute path if provided const absolutePath = path ? toAbsolutePath(path) : undefined; const cmdArgs = [...(absolutePath ? [absolutePath] : []), ...options]; const { stdout, stderr } = await executeDartCommand('analyze', cmdArgs); return { content: [ { type: "text" as const, text: stdout || stderr } ], isError: !!stderr }; }
- src/tools/analyze.ts:5-8 (schema)Zod schema defining the input parameters for the 'dart-analyze' tool: optional path and options.export const analyzeSchema = z.object({ path: z.string().optional().describe('Directory or file to analyze'), options: z.array(z.string()).optional().describe('Additional options for the dart analyze command') });
- src/index.ts:33-33 (registration)Registration of the 'dart-analyze' tool with the MCP server, linking the schema and handler function.server.tool('dart-analyze', analyzeSchema.shape, analyze);