Skip to main content
Glama

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
NameRequiredDescriptionDefault
pathNoDirectory or file to analyze
optionsNoAdditional options for the dart analyze command

Implementation Reference

  • 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 }; }
  • 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);

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