Skip to main content
Glama

Zypin MCP

tools.js•3.78 kB
/** * MCP tools implementation for Zypin MCP * Generic tool collection with browser automation and template management * * TODO: * - Add template validation before creation * - Improve error messages with specific CLI command suggestions * - Add support for custom tool parameters */ import { createPlaywrightTools } from './tools-playwright.js'; import { execSync } from 'child_process'; import fs from 'fs'; import path from 'path'; import templateScanner from 'zypin-core/core/template-scanner.js'; export function createTools(browser) { const playwrightTools = createPlaywrightTools(browser); return [ ...playwrightTools, // 1. Get Zypin Templates { name: 'get_zypin_templates', description: 'Get available Zypin templates with descriptions', inputSchema: { type: 'object', properties: {}, required: [] }, handler: () => { const templates = templateScanner.getTemplates(); const result = []; for (const template of templates) { const packagePath = path.join(template.path, 'package.json'); if (fs.existsSync(packagePath)) { const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8')); result.push({ name: template.namespacedName, description: pkg.description || template.name }); } } return { message: `šŸ“‹ Available Templates:\n${result.map((t, i) => `${i + 1}. ${t.name} - ${t.description}`).join('\n')}`, templates: result }; } }, // 2. Create Zypin Template { name: 'create_zypin_template', description: 'Create new project from Zypin template', inputSchema: { type: 'object', properties: { projectName: { type: 'string', description: 'Project name' }, template: { type: 'string', description: 'Template name (e.g., selenium/cucumber-bdd)' }, workingDirectory: { type: 'string', description: 'Directory to create project in' } }, required: ['projectName', 'template', 'workingDirectory'] }, handler: ({ projectName, template, workingDirectory }) => { const command = `zypin create-project ${projectName} --template ${template} --force`; const result = execSync(command, { stdio: 'pipe', cwd: workingDirectory, encoding: 'utf8' }); return { message: result, projectPath: path.join(workingDirectory, projectName), nextSteps: [`cd ${projectName}`, 'npm install'], guidance: { write: 'zypin guide --write', debug: 'zypin guide --debug' } }; } }, // 3. Get Template Info { name: 'get_template_info', description: 'Get detailed information about a specific template', inputSchema: { type: 'object', properties: { template: { type: 'string', description: 'Template name (e.g., selenium/cucumber-bdd)' } }, required: ['template'] }, handler: ({ template }) => { const templates = templateScanner.getTemplates(); const foundTemplate = templates.find(t => t.namespacedName === template); if (!foundTemplate) { throw new Error(`Template "${template}" not found`); } const readmePath = path.join(foundTemplate.path, 'README.md'); if (!fs.existsSync(readmePath)) { throw new Error(`README.md not found for template "${template}"`); } const content = fs.readFileSync(readmePath, 'utf8'); return { message: `šŸ“– Template Info: ${template}`, content: content }; } } ]; }

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/zypin-testing/zypin-mcp'

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