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[]);

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