dart-fix
Apply automated code fixes to Dart files or directories to resolve issues and improve code quality.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Directory or file to apply fixes to | |
| apply | No | Whether to apply the suggested fixes | |
| options | No | Additional fix options |
Implementation Reference
- src/tools/fix.ts:11-31 (handler)The handler function that executes the 'dart fix' command, handling path resolution, apply/dry-run flags, and returns stdout/stderr.export async function fix(args: z.infer<typeof fixSchema>) { const { path, apply, options = [] } = args; // Convert relative path to absolute path if provided const absolutePath = path ? toAbsolutePath(path) : undefined; const cmdArgs = [ ...(absolutePath ? [absolutePath] : []), ...(apply ? ['--apply'] : ['--dry-run']), ...options ]; const { stdout, stderr } = await executeDartCommand('fix', cmdArgs); return { content: [ { type: "text" as const, text: stdout || stderr } ], isError: !!stderr }; }
- src/tools/fix.ts:5-9 (schema)Zod schema defining the input parameters for the 'dart-fix' tool: optional path, apply flag, and additional options.export const fixSchema = z.object({ path: z.string().optional().describe('Directory or file to apply fixes to'), apply: z.boolean().default(true).describe('Whether to apply the suggested fixes'), options: z.array(z.string()).optional().describe('Additional fix options') });
- src/index.ts:37-37 (registration)Registration of the 'dart-fix' tool with the MCP server, linking schema and handler.server.tool('dart-fix', fixSchema.shape, fix);
- src/index.ts:19-19 (registration)Import of the fix handler and schema from the fix tool module.import { fix, fixSchema } from './tools/fix.js';
- src/config/mcp-config.ts:9-9 (helper)Tool description in server configuration.'dart-fix': "Apply automated fixes to Dart source code",