Skip to main content
Glama

dart-fix

Apply automated code fixes to Dart files or directories to resolve issues and improve code quality.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoDirectory or file to apply fixes to
applyNoWhether to apply the suggested fixes
optionsNoAdditional fix options

Implementation Reference

  • 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 }; }
  • 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';
  • Tool description in server configuration.
    'dart-fix': "Apply automated fixes to Dart source code",

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/egyleader/dart-mcp'

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