Skip to main content
Glama

webforge_create_project

Create a new website project by specifying business type, name, and optional design elements like style and color palette for local businesses.

Instructions

Create a new website project in WebForge

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProject name
business_typeYesType of business
descriptionNoOptional project description
style_idNoOptional style ID to assign
palette_idNoOptional palette ID to assign
domainNoOptional custom domain

Implementation Reference

  • Core implementation of createProject function that validates input, checks style/palette existence, inserts the project into the database, and returns the created project.
    export async function createProject(projectData: CreateProjectRequest): Promise<Project> {
      try {
        if (!projectData.name || !projectData.business_type) {
          throw new Error('Project name and business type are required');
        }
    
        const client = supabase.getAnonClient();
        
        // Validate style_id if provided
        if (projectData.style_id) {
          const { data: styleExists, error: styleError } = await client
            .from('design_styles')
            .select('id')
            .eq('id', projectData.style_id)
            .single();
            
          if (styleError || !styleExists) {
            throw new Error(`Style with ID '${projectData.style_id}' not found`);
          }
        }
    
        // Validate palette_id if provided
        if (projectData.palette_id) {
          const { data: paletteExists, error: paletteError } = await client
            .from('design_palettes')
            .select('id')
            .eq('id', projectData.palette_id)
            .single();
            
          if (paletteError || !paletteExists) {
            throw new Error(`Palette with ID '${projectData.palette_id}' not found`);
          }
        }
    
        const newProject = {
          name: projectData.name,
          business_type: projectData.business_type,
          description: projectData.description || null,
          style_id: projectData.style_id || null,
          palette_id: projectData.palette_id || null,
          domain: projectData.domain || null,
          status: 'draft' as const,
          // user_id will be set by RLS if authentication is properly configured
        };
    
        const { data, error } = await client
          .from('projects')
          .insert(newProject)
          .select()
          .single();
    
        if (error) {
          supabase.log(`Error creating project: ${error.message}`, 'error');
          throw new Error(`Failed to create project: ${error.message}`);
        }
    
        if (!data) {
          throw new Error('Failed to create project: No data returned');
        }
    
        supabase.log(`Created project: ${data.name} (${data.id})`);
    
        return data as Project;
    
      } catch (error) {
        supabase.log(`Error in createProject: ${error}`, 'error');
        throw error;
      }
    }
  • src/index.ts:103-137 (registration)
    Tool registration with input schema definition for webforge_create_project in the ListToolsRequestSchema handler.
    {
      name: 'webforge_create_project',
      description: 'Create a new website project in WebForge',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Project name',
          },
          business_type: {
            type: 'string',
            description: 'Type of business',
          },
          description: {
            type: 'string',
            description: 'Optional project description',
          },
          style_id: {
            type: 'string',
            description: 'Optional style ID to assign',
          },
          palette_id: {
            type: 'string',
            description: 'Optional palette ID to assign',
          },
          domain: {
            type: 'string',
            description: 'Optional custom domain',
          },
        },
        required: ['name', 'business_type'],
        additionalProperties: false,
      },
    },
  • MCP tool handler that receives tool calls, validates arguments, and delegates to createProject function.
    case 'webforge_create_project': {
      const projectData = args as {
        name: string;
        business_type: string;
        description?: string;
        style_id?: string;
        palette_id?: string;
        domain?: string;
      };
      const result = await createProject(projectData);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • TypeScript interface defining the input type for createProject function.
    export interface CreateProjectRequest {
      name: string;
      business_type: string;
      description?: string;
      style_id?: string;
      palette_id?: string;
      domain?: string;
    }
  • TypeScript interface defining the Project type returned by createProject function.
    export interface Project {
      id?: string;
      user_id?: string;
      name: string;
      business_type: string;
      description?: string;
      style_id?: string;
      palette_id?: string;
      domain?: string;
      status: 'draft' | 'published' | 'archived';
      created_at?: string;
      updated_at?: string;
    }

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/joytorm/webforge-mcp'

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