Skip to main content
Glama

scaffold_project

Create projects from templates with customizable variables and destination paths using the MCP File Forge server's secure file operations.

Instructions

Create a project from a template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYesTemplate name or path
destinationYesDestination directory
variablesNoTemplate variables
overwriteNoOverwrite existing files

Implementation Reference

  • The implementation of the scaffold_project tool logic.
    async function scaffoldProjectImpl(input: ScaffoldProjectInput): Promise<ToolResult> {
      try {
        // Find the template
        const template = await findTemplate(input.template);
    
        if (!template) {
          return {
            isError: true,
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  code: 'FILE_NOT_FOUND',
                  message: `Template not found: ${input.template}`,
                  details: {
                    searched_paths: getTemplatePaths(),
                  },
                }),
              },
            ],
          };
        }
    
        // Check destination
        const destPath = path.resolve(input.destination);
        let destExists = false;
        try {
          await fs.access(destPath);
          destExists = true;
        } catch {
          // Destination doesn't exist
        }
    
        if (destExists && !input.overwrite) {
          // Check if directory is empty
          const entries = await fs.readdir(destPath);
          if (entries.length > 0) {
            return {
              isError: true,
              content: [
                {
                  type: 'text',
                  text: JSON.stringify({
                    code: 'ALREADY_EXISTS',
                    message: `Destination directory is not empty: ${input.destination}`,
                  }),
                },
              ],
            };
          }
        }
    
        // Merge default variables with provided variables
        const variables: Record<string, string> = {
          PROJECT_NAME: path.basename(destPath),
          CURRENT_YEAR: new Date().getFullYear().toString(),
          CURRENT_DATE: new Date().toISOString().split('T')[0],
          ...input.variables,
        };
    
        // Copy template to destination
        const result = await copyTemplateDir(
          template.path,
          destPath,
          variables,
          input.overwrite
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  template: {
                    name: template.metadata.name,
                    path: template.path,
                  },
                  destination: destPath,
                  files_created: result.files.length,
                  files_skipped: result.skipped.length,
                  variables_used: variables,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        const err = error as Error;
    
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                code: 'UNKNOWN_ERROR',
                message: `Error scaffolding project: ${err.message}`,
              }),
            },
          ],
        };
      }
    }
  • The registration of the scaffold_project tool with the MCP server.
    // scaffold_project tool
    server.tool(
      'scaffold_project',
      'Create a project from a template',
      {
        template: z.string().describe('Template name or path'),
        destination: z.string().describe('Destination directory'),
        variables: z
          .record(z.string())
          .optional()
          .describe('Template variables'),
        overwrite: z.boolean().optional().describe('Overwrite existing files'),
      },
      async (args) => {
        const input = ScaffoldProjectInputSchema.parse(args);
        return await scaffoldProjectImpl(input);
      }
    );
  • Input schema and type definition for scaffold_project.
    export const ScaffoldProjectInputSchema = z.object({
      template: z.string().describe('Template name or path'),
      destination: z.string().describe('Destination directory'),
      variables: z.record(z.string()).optional().describe('Template variables'),
      overwrite: z.boolean().default(false).describe('Overwrite existing'),
    });
    
    export type ScaffoldProjectInput = z.infer<typeof ScaffoldProjectInputSchema>;
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states 'Create a project from a template', which implies a write/mutation operation, but doesn't disclose behavioral traits like permissions needed, whether it's idempotent, error handling, or what happens on failure. The 'overwrite' parameter hints at some behavior, but the description itself doesn't elaborate.

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 with zero waste. It's front-loaded and appropriately sized for the tool's complexity, earning its place by stating the core purpose clearly.

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 tool has 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, return values, or error conditions. For a mutation tool with this complexity, more context is needed to guide the agent 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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond the schema—it doesn't explain parameter interactions, default values, or examples. Baseline is 3 since the schema does the heavy lifting.

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 verb ('Create') and resource ('project'), specifying it's 'from a template'. It distinguishes from siblings like 'create_directory' by mentioning the template aspect. However, it doesn't explicitly differentiate from all siblings (e.g., 'list_templates' is related but not directly contrasted).

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 (e.g., needing templates available), exclusions, or comparisons to sibling tools like 'create_directory' or 'list_templates'. Usage is implied but not explicitly stated.

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/mcp-tool-shop-org/mcp-file-forge'

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