Skip to main content
Glama

get_plugin_scaffold_template

Generate a plugin scaffold template for Backstage development by specifying plugin type, name, and optional features to accelerate plugin creation.

Instructions

Generate a plugin scaffold template with specified configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pluginTypeYesType of plugin to scaffold
pluginNameYesName of the plugin
featuresNoFeatures to include in the plugin

Implementation Reference

  • src/index.ts:138-164 (registration)
    Registration of the 'get_plugin_scaffold_template' tool in the ListTools handler, including description and input schema.
    {
      name: 'get_plugin_scaffold_template',
      description: 'Generate a plugin scaffold template with specified configuration',
      inputSchema: {
        type: 'object',
        properties: {
          pluginType: {
            type: 'string',
            description: 'Type of plugin to scaffold',
            enum: ['frontend', 'backend', 'fullstack', 'common']
          },
          pluginName: {
            type: 'string',
            description: 'Name of the plugin'
          },
          features: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['routing', 'api-client', 'entity-provider', 'scaffolder-action', 'search-collator']
            },
            description: 'Features to include in the plugin'
          }
        },
        required: ['pluginType', 'pluginName']
      }
    }
  • The main handler function that orchestrates generation of the plugin scaffold template and returns it as JSON content.
    private getPluginScaffoldTemplate(pluginType: string, pluginName: string, features: string[] = []) {
      const template = {
        pluginName,
        pluginType,
        features,
        files: this.generatePluginFiles(pluginType, pluginName, features),
        commands: this.generatePluginCommands(pluginType, pluginName),
        dependencies: this.generatePluginDependencies(pluginType, features)
      };
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(template, null, 2),
          },
        ],
      };
    }
  • Helper function that generates the file structure and contents for different plugin types.
    private generatePluginFiles(pluginType: string, pluginName: string, features: string[]) {
      const files: any = {};
    
      // Base files
      files[`plugins/${pluginName}/package.json`] = this.generatePackageJson(pluginName, pluginType);
      files[`plugins/${pluginName}/src/index.ts`] = this.generateIndexFile(pluginType);
    
      if (pluginType === 'frontend' || pluginType === 'fullstack') {
        files[`plugins/${pluginName}/src/plugin.ts`] = this.generateFrontendPlugin(pluginName);
        files[`plugins/${pluginName}/src/routes.ts`] = this.generateRoutes();
        files[`plugins/${pluginName}/src/components/ExampleComponent.tsx`] = this.generateExampleComponent(pluginName);
      }
    
      if (pluginType === 'backend' || pluginType === 'fullstack') {
        files[`plugins/${pluginName}-backend/src/plugin.ts`] = this.generateBackendPlugin(pluginName);
        files[`plugins/${pluginName}-backend/src/router.ts`] = this.generateRouter();
      }
    
      return files;
    }
  • Helper function that generates the package.json content based on plugin type.
    private generatePackageJson(pluginName: string, pluginType: string) {
      return JSON.stringify({
        name: `@internal/${pluginName}${pluginType === 'backend' ? '-backend' : ''}`,
        version: '0.1.0',
        main: 'src/index.ts',
        types: 'src/index.ts',
        license: 'Apache-2.0',
        dependencies: pluginType === 'frontend' ? {
          '@backstage/core-components': '^0.14.0',
          '@backstage/core-plugin-api': '^1.9.0',
          '@backstage/theme': '^0.5.0',
          'react': '^17.0.2 || ^18.0.0',
          'react-router-dom': '^6.3.0'
        } : {
          '@backstage/backend-common': '^0.23.0',
          '@backstage/backend-plugin-api': '^0.7.0',
          'express': '^4.17.1',
          'express-promise-router': '^4.1.0'
        }
      }, null, 2);
    }
  • Dispatch case in CallToolRequestSchema handler that invokes the tool's main function.
    case 'get_plugin_scaffold_template':
      return this.getPluginScaffoldTemplate(args?.pluginType as string, args?.pluginName as string, args?.features as string[]);
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 of behavioral disclosure. It states 'Generate' implies a creation or output operation, but doesn't specify what is generated (e.g., files, code structure), whether it's read-only or modifies anything, or any side effects like overwriting existing files. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 front-loads the core action and resource without any wasted words. It's appropriately sized for the tool's complexity, making it easy to parse quickly while conveying the essential purpose.

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 no annotations and no output schema, the description is incomplete for a tool that generates something. It doesn't explain what the output is (e.g., a file, directory structure, or code snippets), any dependencies, or error conditions. For a 3-parameter tool with no structured behavioral data, the description should provide more context about the generation process and results.

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 already documents all parameters (pluginType, pluginName, features) with descriptions and enums. The description adds minimal value beyond the schema by mentioning 'specified configuration', which loosely maps to the parameters but doesn't provide additional syntax or usage details. Baseline 3 is appropriate as the schema handles most of the parameter documentation.

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 action ('Generate') and resource ('plugin scaffold template'), specifying it's for a template with configuration. It distinguishes from siblings like 'get_plugin_development_guide' by focusing on scaffold generation rather than guidance. However, it doesn't explicitly differentiate from all siblings, such as 'get_backstage_examples', which might also involve templates.

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, such as needing a plugin development environment, or contrast with siblings like 'get_plugin_development_guide' for learning versus this tool for creation. Usage is implied only by the action 'Generate', with no explicit context or exclusions.

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/PawelWaj/MCP'

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