Skip to main content
Glama

generate_app

Create a Next.js application to manage workflow data with customizable stages, dashboard, API endpoints, database setup, and approval features.

Instructions

Generate a Next.js app for managing workflow data within the current project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the app directory (e.g., "app", "dashboard")
stagesNoWorkflow stages for pipeline view (default: created, processing, review, completed)
featuresNoFeatures to include in the app

Implementation Reference

  • The main tool handler for 'generate_app'. Parses input arguments, creates an AppGenerator instance with the project path, calls generateApp with config, handles success/error responses with detailed user feedback including next steps.
    case 'generate_app':
      const appName = args?.name as string;
      const stages = args?.stages as string[] || ['created', 'processing', 'review', 'completed'];
      const features = args?.features || {
        dashboard: true,
        api: true,
        database: true,
        webhooks: true,
        approvals: false
      };
    
      // Get project path (parent of workflows directory)
      const projectPath = path.dirname(this.workflowsPath);
    
      // Create app generator
      const appGenerator = new AppGenerator(projectPath);
    
      try {
        await appGenerator.generateApp({
          name: appName,
          projectPath,
          features,
          stages
        });
    
        return {
          content: [{
            type: 'text',
            text: `✅ Successfully generated Next.js app: ${appName}\\n\\n` +
              `📁 Location: ${path.join(projectPath, appName)}\\n\\n` +
              `Features included:\\n` +
              `• Dashboard: ${features.dashboard ? 'Yes' : 'No'}\\n` +
              `• API Endpoints: ${features.api ? 'Yes' : 'No'}\\n` +
              `• Database (SQLite): ${features.database ? 'Yes' : 'No'}\\n` +
              `• Webhook Receivers: ${features.webhooks ? 'Yes' : 'No'}\\n` +
              `• Approval System: ${features.approvals ? 'Yes' : 'No'}\\n\\n` +
              `Pipeline Stages: ${stages.join(' → ')}\\n\\n` +
              `Next steps:\\n` +
              `1. cd ${appName}\\n` +
              `2. npm install\\n` +
              `3. npm run dev\\n\\n` +
              `The app will be available at http://localhost:3000\\n\\n` +
              `To integrate with n8n workflows:\\n` +
              `• Use the tracking system: mcflow add_tracking --storageUrl http://localhost:3000\\n` +
              `• Or add HTTP Request nodes manually to your workflows`
          }]
        };
      } catch (error: any) {
        return {
          content: [{
            type: 'text',
            text: `❌ Failed to generate app: ${error.message}`
          }]
        };
      }
  • Input schema for the generate_app tool, specifying required 'name' parameter and optional 'stages' array and 'features' object with booleans for dashboard, api, database, webhooks, approvals.
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Name of the app directory (e.g., "app", "dashboard")',
        },
        stages: {
          type: 'array',
          items: { type: 'string' },
          description: 'Workflow stages for pipeline view (default: created, processing, review, completed)',
        },
        features: {
          type: 'object',
          properties: {
            dashboard: {
              type: 'boolean',
              description: 'Include dashboard with stats and tables',
            },
            api: {
              type: 'boolean',
              description: 'Include API endpoints for workflow integration',
            },
            database: {
              type: 'boolean',
              description: 'Include SQLite database setup',
            },
            webhooks: {
              type: 'boolean',
              description: 'Include webhook receivers for n8n',
            },
            approvals: {
              type: 'boolean',
              description: 'Include approval/reject functionality',
            },
          },
          description: 'Features to include in the app',
        },
      },
      required: ['name'],
  • Registration of the 'generate_app' tool in the MCP tools definitions array exported by getToolDefinitions().
    {
      name: 'generate_app',
      description: 'Generate a Next.js app for managing workflow data within the current project',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the app directory (e.g., "app", "dashboard")',
          },
          stages: {
            type: 'array',
            items: { type: 'string' },
            description: 'Workflow stages for pipeline view (default: created, processing, review, completed)',
          },
          features: {
            type: 'object',
            properties: {
              dashboard: {
                type: 'boolean',
                description: 'Include dashboard with stats and tables',
              },
              api: {
                type: 'boolean',
                description: 'Include API endpoints for workflow integration',
              },
              database: {
                type: 'boolean',
                description: 'Include SQLite database setup',
              },
              webhooks: {
                type: 'boolean',
                description: 'Include webhook receivers for n8n',
              },
              approvals: {
                type: 'boolean',
                description: 'Include approval/reject functionality',
              },
            },
            description: 'Features to include in the app',
          },
        },
        required: ['name'],
      },
    },
  • Core generateApp method of AppGenerator class. Orchestrates creation of Next.js app: checks existence, creates directories, generates package.json, DB schema, API routes, dashboard pages, components, styles, env files, and gitignore.
    async generateApp(config: AppConfig): Promise<void> {
      const appPath = path.join(this.projectPath, config.name);
    
      // Check if app already exists
      try {
        await fs.access(appPath);
        throw new Error(`App directory ${config.name} already exists`);
      } catch (error: any) {
        if (error.code !== 'ENOENT') throw error;
      }
    
      // Create app structure
      await this.createAppStructure(appPath);
    
      // Generate files based on features
      await this.generatePackageJson(appPath, config);
      await this.generateDatabaseSchema(appPath);
      await this.generateApiEndpoints(appPath, config);
      await this.generateDashboard(appPath, config);
      await this.generateComponents(appPath, config);
      await this.generateStyles(appPath);
      await this.generateEnvFile(appPath);
    
      // Initialize git ignore
      await this.generateGitIgnore(appPath);
    }
  • TypeScript interface AppConfig defining the configuration structure passed to generateApp method, matching the tool input schema.
    export interface AppConfig {
      name: string;
      projectPath: string;
      features?: {
        dashboard?: boolean;
        api?: boolean;
        database?: boolean;
        webhooks?: boolean;
        approvals?: boolean;
      };
      stages?: string[];
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool generates an app but doesn't explain what that entails—whether it modifies existing files, requires specific permissions, has side effects, or what the output looks like. For a tool that likely creates files and directories, this lack of detail is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of generating an app (likely involving file creation and configuration), no annotations, and no output schema, the description is insufficient. It doesn't cover behavioral aspects, output format, or integration details, leaving significant gaps for the agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't add any parameter semantics beyond what the input schema provides. Since schema description coverage is 100%, the schema already documents all parameters thoroughly. The baseline score of 3 is appropriate as the schema does the heavy lifting, but the description offers no additional context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates a Next.js app for managing workflow data within the current project, providing a specific verb ('generate') and resource ('Next.js app'). However, it doesn't explicitly differentiate from sibling tools like 'generate' or 'create', which could be ambiguous in this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when not to use it, or how it relates to sibling tools like 'create', 'deploy', or other generation tools. The agent must infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mckinleymedia/mcflow-mcp'

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