template.ts•11 kB
import { Tool } from '@modelcontextprotocol/sdk/types.js';
export const templateTools: Tool[] = [
{
name: 'generate_boilerplate',
description: 'Generate project boilerplate based on extracted patterns from a repository',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL to use as template source',
},
templateType: {
type: 'string',
enum: ['starter', 'component-library', 'microservice', 'fullstack', 'cli-tool', 'library'],
description: 'Type of template to generate',
},
options: {
type: 'object',
properties: {
name: {
type: 'string',
description: 'Name for the generated project',
},
description: {
type: 'string',
description: 'Description for the generated project',
},
framework: {
type: 'string',
description: 'Target framework',
},
language: {
type: 'string',
description: 'Target programming language',
},
includeTests: {
type: 'boolean',
description: 'Include test setup and examples',
default: true,
},
includeDocs: {
type: 'boolean',
description: 'Include documentation templates',
default: true,
},
includeCI: {
type: 'boolean',
description: 'Include CI/CD configuration',
default: true,
},
includeDocker: {
type: 'boolean',
description: 'Include Docker configuration',
default: false,
},
packageManager: {
type: 'string',
enum: ['npm', 'yarn', 'pnpm', 'bun'],
description: 'Package manager to use',
default: 'npm',
},
},
},
},
required: ['url', 'templateType'],
},
},
{
name: 'create_component_library',
description: 'Create a standalone component library from extracted components',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL',
},
componentPaths: {
type: 'array',
items: { type: 'string' },
description: 'Paths to components to include in library',
},
libraryOptions: {
type: 'object',
properties: {
name: {
type: 'string',
description: 'Library name',
},
version: {
type: 'string',
description: 'Initial version',
default: '1.0.0',
},
bundler: {
type: 'string',
enum: ['rollup', 'webpack', 'vite', 'parcel'],
description: 'Bundler to use',
default: 'rollup',
},
outputFormats: {
type: 'array',
items: {
type: 'string',
enum: ['esm', 'cjs', 'umd', 'iife'],
},
description: 'Output formats',
default: ['esm', 'cjs'],
},
includeStorybook: {
type: 'boolean',
description: 'Include Storybook setup',
default: true,
},
includeJest: {
type: 'boolean',
description: 'Include Jest testing setup',
default: true,
},
includeTSDoc: {
type: 'boolean',
description: 'Include TypeScript documentation',
default: true,
},
},
},
},
required: ['url'],
},
},
{
name: 'scaffold_project_structure',
description: 'Generate project structure based on analyzed repository patterns',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL to analyze for structure',
},
projectType: {
type: 'string',
enum: ['web-app', 'api', 'library', 'cli', 'desktop', 'mobile', 'monorepo'],
description: 'Type of project to scaffold',
},
structureOptions: {
type: 'object',
properties: {
preserveStructure: {
type: 'boolean',
description: 'Preserve original folder structure',
default: false,
},
modernizeStructure: {
type: 'boolean',
description: 'Apply modern project structure patterns',
default: true,
},
includeConfig: {
type: 'boolean',
description: 'Include configuration files',
default: true,
},
includeBuild: {
type: 'boolean',
description: 'Include build configuration',
default: true,
},
includeScripts: {
type: 'boolean',
description: 'Include package scripts',
default: true,
},
createReadme: {
type: 'boolean',
description: 'Create README with project information',
default: true,
},
},
},
},
required: ['url', 'projectType'],
},
},
{
name: 'generate_integration_code',
description: 'Generate integration code and adapters for using extracted components',
inputSchema: {
type: 'object',
properties: {
sourceUrl: {
type: 'string',
description: 'GitHub repository URL of source code',
},
targetProject: {
type: 'object',
properties: {
framework: {
type: 'string',
description: 'Target framework',
},
language: {
type: 'string',
description: 'Target language',
},
structure: {
type: 'object',
description: 'Target project structure',
},
},
required: ['framework'],
},
integrationOptions: {
type: 'object',
properties: {
adapterType: {
type: 'string',
enum: ['direct', 'wrapper', 'facade', 'bridge'],
description: 'Type of adapter to generate',
default: 'wrapper',
},
includeTypes: {
type: 'boolean',
description: 'Include TypeScript type definitions',
default: true,
},
includeExamples: {
type: 'boolean',
description: 'Include usage examples',
default: true,
},
includeTests: {
type: 'boolean',
description: 'Include integration tests',
default: true,
},
generateDocs: {
type: 'boolean',
description: 'Generate integration documentation',
default: true,
},
},
},
},
required: ['sourceUrl', 'targetProject'],
},
},
{
name: 'create_migration_guide',
description: 'Create step-by-step migration guide for integrating extracted code',
inputSchema: {
type: 'object',
properties: {
sourceUrl: {
type: 'string',
description: 'GitHub repository URL of source code',
},
targetProject: {
type: 'object',
properties: {
framework: {
type: 'string',
description: 'Target framework',
},
currentVersion: {
type: 'string',
description: 'Current version of target project',
},
constraints: {
type: 'array',
items: { type: 'string' },
description: 'Migration constraints (e.g., no breaking changes)',
},
},
required: ['framework'],
},
migrationOptions: {
type: 'object',
properties: {
includeBackup: {
type: 'boolean',
description: 'Include backup steps',
default: true,
},
includeRollback: {
type: 'boolean',
description: 'Include rollback instructions',
default: true,
},
includeTesting: {
type: 'boolean',
description: 'Include testing steps',
default: true,
},
includeValidation: {
type: 'boolean',
description: 'Include validation steps',
default: true,
},
estimateTime: {
type: 'boolean',
description: 'Include time estimates',
default: true,
},
},
},
},
required: ['sourceUrl', 'targetProject'],
},
},
{
name: 'generate_starter_template',
description: 'Generate a complete starter template based on repository analysis',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL to use as base',
},
templateName: {
type: 'string',
description: 'Name for the starter template',
},
templateOptions: {
type: 'object',
properties: {
extractBestPractices: {
type: 'boolean',
description: 'Extract and apply best practices',
default: true,
},
modernizeCode: {
type: 'boolean',
description: 'Modernize code patterns',
default: true,
},
addTemplateVars: {
type: 'boolean',
description: 'Add template variables for customization',
default: true,
},
includeExamples: {
type: 'boolean',
description: 'Include usage examples',
default: true,
},
createCLI: {
type: 'boolean',
description: 'Create CLI tool for template generation',
default: false,
},
supportedPlatforms: {
type: 'array',
items: { type: 'string' },
description: 'Supported platforms (e.g., ["web", "mobile", "desktop"])',
},
},
},
},
required: ['url', 'templateName'],
},
},
];