Skip to main content
Glama

flutter_pub_get

Install Flutter project dependencies by running pub get in the specified working directory to resolve and fetch required packages.

Instructions

Install Flutter project dependencies (pub get)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYesWorking directory (Flutter project root)

Implementation Reference

  • Handler function that validates input using FlutterPubGetSchema, verifies it's a Flutter project, executes 'flutter pub get' command, and returns detailed results including exit code, output, errors, and duration.
    handler: async (args: any) => { const validation = FlutterPubGetSchema.safeParse(args); if (!validation.success) { throw new Error(`Invalid request: ${validation.error.message}`); } const { cwd } = validation.data; // Validate that it's a Flutter project await validateFlutterProject(cwd); const result = await processExecutor.execute('flutter', ['pub', 'get'], { cwd, timeout: 300000, // 5 minutes timeout for pub get }); return { success: true, data: { projectPath: cwd, exitCode: result.exitCode, output: result.stdout, errors: result.stderr, duration: result.duration, success: result.exitCode === 0, }, }; }
  • Zod schema defining the input validation for the flutter_pub_get tool, requiring a 'cwd' parameter.
    * Zod validation schema for flutter_pub_get tool. * * @type {z.ZodObject} * @property {string} cwd - Working directory (Flutter project root) */ const FlutterPubGetSchema = z.object({ cwd: z.string().min(1), });
  • Registers the flutter_pub_get tool in the tools Map within createFlutterTools function, specifying name, description, JSON inputSchema, and references the handler function.
    tools.set('flutter_pub_get', { name: 'flutter_pub_get', description: 'Install Flutter project dependencies (pub get)', inputSchema: { type: 'object', properties: { cwd: { type: 'string', minLength: 1, description: 'Working directory (Flutter project root)' } }, required: ['cwd'] }, handler: async (args: any) => { const validation = FlutterPubGetSchema.safeParse(args); if (!validation.success) { throw new Error(`Invalid request: ${validation.error.message}`); } const { cwd } = validation.data; // Validate that it's a Flutter project await validateFlutterProject(cwd); const result = await processExecutor.execute('flutter', ['pub', 'get'], { cwd, timeout: 300000, // 5 minutes timeout for pub get }); return { success: true, data: { projectPath: cwd, exitCode: result.exitCode, output: result.stdout, errors: result.stderr, duration: result.duration, success: result.exitCode === 0, }, }; } });

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/cristianoaredes/mcp-mobile-server'

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