transform.ts•8.93 kB
import { Tool } from '@modelcontextprotocol/sdk/types.js';
export const transformTools: Tool[] = [
{
name: 'convert_framework',
description: 'Convert code between different frameworks (e.g., React to Vue, Express to Fastify)',
inputSchema: {
type: 'object',
properties: {
code: {
type: 'string',
description: 'Source code to convert',
},
sourceFramework: {
type: 'string',
description: 'Source framework (e.g., "react", "vue", "angular", "express")',
},
targetFramework: {
type: 'string',
description: 'Target framework',
},
conversionOptions: {
type: 'object',
properties: {
preserveStructure: {
type: 'boolean',
description: 'Preserve original code structure as much as possible',
default: true,
},
includeComments: {
type: 'boolean',
description: 'Include explanatory comments in converted code',
default: true,
},
convertStyles: {
type: 'boolean',
description: 'Convert styling approach if applicable',
default: true,
},
convertTests: {
type: 'boolean',
description: 'Convert test files if present',
default: true,
},
},
},
},
required: ['code', 'sourceFramework', 'targetFramework'],
},
},
{
name: 'update_api_patterns',
description: 'Update API patterns and endpoints to modern conventions',
inputSchema: {
type: 'object',
properties: {
code: {
type: 'string',
description: 'Source code containing API patterns',
},
currentPattern: {
type: 'string',
enum: ['rest', 'graphql', 'rpc', 'websocket'],
description: 'Current API pattern',
},
targetPattern: {
type: 'string',
enum: ['rest', 'graphql', 'rpc', 'websocket'],
description: 'Target API pattern',
},
updateOptions: {
type: 'object',
properties: {
addValidation: {
type: 'boolean',
description: 'Add input validation',
default: true,
},
addErrorHandling: {
type: 'boolean',
description: 'Add comprehensive error handling',
default: true,
},
addDocumentation: {
type: 'boolean',
description: 'Add API documentation',
default: true,
},
addSecurity: {
type: 'boolean',
description: 'Add security middleware',
default: true,
},
},
},
},
required: ['code', 'currentPattern', 'targetPattern'],
},
},
{
name: 'extract_business_logic',
description: 'Extract business logic from framework-specific code',
inputSchema: {
type: 'object',
properties: {
code: {
type: 'string',
description: 'Source code containing business logic',
},
framework: {
type: 'string',
description: 'Framework to extract from',
},
extractionOptions: {
type: 'object',
properties: {
createInterfaces: {
type: 'boolean',
description: 'Create interfaces for extracted logic',
default: true,
},
addTypes: {
type: 'boolean',
description: 'Add TypeScript types',
default: true,
},
createTests: {
type: 'boolean',
description: 'Create unit tests for extracted logic',
default: false,
},
separateUtilities: {
type: 'boolean',
description: 'Separate utility functions',
default: true,
},
},
},
},
required: ['code', 'framework'],
},
},
{
name: 'migrate_database_layer',
description: 'Migrate database layer between different ORMs or query builders',
inputSchema: {
type: 'object',
properties: {
code: {
type: 'string',
description: 'Database layer code to migrate',
},
sourceORM: {
type: 'string',
description: 'Source ORM (e.g., "sequelize", "typeorm", "prisma")',
},
targetORM: {
type: 'string',
description: 'Target ORM',
},
migrationOptions: {
type: 'object',
properties: {
preserveRelations: {
type: 'boolean',
description: 'Preserve database relations',
default: true,
},
convertValidation: {
type: 'boolean',
description: 'Convert validation rules',
default: true,
},
generateMigrations: {
type: 'boolean',
description: 'Generate migration files',
default: true,
},
convertSeeds: {
type: 'boolean',
description: 'Convert seed files',
default: true,
},
},
},
},
required: ['code', 'sourceORM', 'targetORM'],
},
},
{
name: 'update_build_system',
description: 'Update build system configuration (webpack, vite, rollup, etc.)',
inputSchema: {
type: 'object',
properties: {
configCode: {
type: 'string',
description: 'Build system configuration code',
},
sourceTool: {
type: 'string',
description: 'Source build tool (e.g., "webpack", "vite", "rollup")',
},
targetTool: {
type: 'string',
description: 'Target build tool',
},
projectType: {
type: 'string',
enum: ['library', 'application', 'monorepo'],
description: 'Type of project',
},
features: {
type: 'array',
items: { type: 'string' },
description: 'Features to preserve/add (e.g., ["typescript", "hot-reload", "tree-shaking"])',
},
},
required: ['configCode', 'sourceTool', 'targetTool'],
},
},
{
name: 'convert_testing_framework',
description: 'Convert tests between different testing frameworks',
inputSchema: {
type: 'object',
properties: {
testCode: {
type: 'string',
description: 'Test code to convert',
},
sourceFramework: {
type: 'string',
description: 'Source testing framework (e.g., "jest", "mocha", "vitest")',
},
targetFramework: {
type: 'string',
description: 'Target testing framework',
},
conversionOptions: {
type: 'object',
properties: {
preserveStructure: {
type: 'boolean',
description: 'Preserve test structure',
default: true,
},
convertMocks: {
type: 'boolean',
description: 'Convert mocking syntax',
default: true,
},
convertAssertions: {
type: 'boolean',
description: 'Convert assertion syntax',
default: true,
},
addSetupTeardown: {
type: 'boolean',
description: 'Add setup/teardown hooks',
default: true,
},
},
},
},
required: ['testCode', 'sourceFramework', 'targetFramework'],
},
},
{
name: 'modernize_syntax',
description: 'Modernize language syntax to use latest features',
inputSchema: {
type: 'object',
properties: {
code: {
type: 'string',
description: 'Source code to modernize',
},
language: {
type: 'string',
description: 'Programming language',
},
sourceVersion: {
type: 'string',
description: 'Source language version',
},
targetVersion: {
type: 'string',
description: 'Target language version',
},
transformations: {
type: 'array',
items: { type: 'string' },
description: 'Specific transformations to apply',
},
preserveCompatibility: {
type: 'boolean',
description: 'Preserve backward compatibility where possible',
default: false,
},
},
required: ['code', 'language', 'targetVersion'],
},
},
];