Skip to main content
Glama

generate_task

Create task configurations from templates for specific technologies and task types in CI/CD pipelines, including phase headers for pipeline organization.

Instructions

Generate task configuration from template for a specific technology and task type. Use technology="phase" to create phase headers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
technologyYesTechnology name (e.g., "Go", "Python", "Node.js", "TypeScript", "Rust") or "phase" for phase headers
taskTypeYesTask type (e.g., "check-format", "check-lint", "test-unit", "build") or phase name (e.g., "Validation", "Build")
taskIdNoOptional: custom task ID for regular tasks, or description for phase headers

Implementation Reference

  • The handler function for the 'generate_task' tool. It extracts input parameters (technology, taskType, optional taskId), validates required fields, calls generateTaskConfig utility, and returns the generated TOML configuration as text content.
    case 'generate_task': { const technology = args?.technology as string; const taskType = args?.taskType as string; const taskId = args?.taskId as string | undefined; if (!technology || !taskType) { throw new Error('technology and taskType are required parameters'); } const taskConfig = generateTaskConfig(technology, taskType, taskId); return { content: [ { type: 'text', text: taskConfig, }, ], }; }
  • Input schema definition for the 'generate_task' tool, including properties for technology, taskType (required), and optional taskId, as registered in the ListTools response.
    { name: 'generate_task', description: 'Generate task configuration from template for a specific technology and task type. Use technology="phase" to create phase headers.', inputSchema: { type: 'object', properties: { technology: { type: 'string', description: 'Technology name (e.g., "Go", "Python", "Node.js", "TypeScript", "Rust") or "phase" for phase headers', }, taskType: { type: 'string', description: 'Task type (e.g., "check-format", "check-lint", "test-unit", "build") or phase name (e.g., "Validation", "Build")', }, taskId: { type: 'string', description: 'Optional: custom task ID for regular tasks, or description for phase headers', }, }, required: ['technology', 'taskType'], }, },
  • src/index.ts:252-273 (registration)
    Registration of the 'generate_task' tool in the tools list returned by ListToolsRequestHandler, including name, description, and input schema.
    { name: 'generate_task', description: 'Generate task configuration from template for a specific technology and task type. Use technology="phase" to create phase headers.', inputSchema: { type: 'object', properties: { technology: { type: 'string', description: 'Technology name (e.g., "Go", "Python", "Node.js", "TypeScript", "Rust") or "phase" for phase headers', }, taskType: { type: 'string', description: 'Task type (e.g., "check-format", "check-lint", "test-unit", "build") or phase name (e.g., "Validation", "Build")', }, taskId: { type: 'string', description: 'Optional: custom task ID for regular tasks, or description for phase headers', }, }, required: ['technology', 'taskType'], }, },
  • Core utility function that implements the task generation logic. Uses predefined templates for various technologies and task types to generate TOML configuration snippets for devpipe tasks. Handles phase headers specially and falls back to error messages for unknown combinations.
    export function generateTaskConfig(technology: string, taskType: string, taskId?: string): string { const id = taskId || `${technology.toLowerCase()}-${taskType}`; // Special handling for phase headers if (technology.toLowerCase() === 'phase') { return generatePhaseHeader(taskType, taskId); } const templates: { [key: string]: { [key: string]: any } } = { 'Go': { 'check-format': { name: 'Go Format', desc: 'Verifies that Go code is properly formatted', type: 'check', command: 'gofmt -l .', fixType: 'helper', fixCommand: 'gofmt -w .' }, 'check-lint': { name: 'Golang CI Lint', desc: 'Runs comprehensive linting on Go code', type: 'check', command: 'golangci-lint run', fixType: 'auto', fixCommand: 'golangci-lint run --fix' }, 'check-static': { name: 'Go Vet', desc: 'Examines Go code for suspicious constructs', type: 'check', command: 'go vet ./...' }, 'test-unit': { name: 'Unit Tests', desc: 'Run all unit tests', type: 'test', command: 'go test -v ./...', metricsFormat: 'junit', metricsPath: 'test-results.xml' }, 'build': { name: 'Build Binary', desc: 'Compile Go application', type: 'build', command: 'go build -o bin/app .' } }, 'Python': { 'check-format': { name: 'Python Format Check', desc: 'Check Python code formatting with black', type: 'check', command: 'black --check .', fixType: 'auto', fixCommand: 'black .' }, 'check-lint': { name: 'Python Lint', desc: 'Lint Python code with ruff', type: 'check', command: 'ruff check .', fixType: 'auto', fixCommand: 'ruff check --fix .' }, 'check-types': { name: 'Type Check', desc: 'Check types with mypy', type: 'check', command: 'mypy .' }, 'test-unit': { name: 'Unit Tests', desc: 'Run pytest unit tests', type: 'test', command: 'pytest', metricsFormat: 'junit', metricsPath: 'test-results.xml' } }, 'Node.js': { 'check-lint': { name: 'ESLint', desc: 'Lint JavaScript/TypeScript with ESLint', type: 'check', command: 'npm run lint', fixType: 'auto', fixCommand: 'npm run lint -- --fix' }, 'test-unit': { name: 'Unit Tests', desc: 'Run unit tests', type: 'test', command: 'npm test' }, 'build': { name: 'Build', desc: 'Build the project', type: 'build', command: 'npm run build' } }, 'TypeScript': { 'check-types': { name: 'Type Check', desc: 'Check TypeScript types', type: 'check', command: 'tsc --noEmit' } } }; const techTemplates = templates[technology]; if (!techTemplates) { return `# No template available for ${technology}\n# Please create a custom task`; } const template = techTemplates[taskType]; if (!template) { return `# No template available for ${technology} ${taskType}\n# Available types: ${Object.keys(techTemplates).join(', ')}`; } // Generate TOML let toml = `[tasks.${id}]\n`; toml += `name = "${template.name}"\n`; toml += `desc = "${template.desc}"\n`; toml += `type = "${template.type}"\n`; toml += `command = "${template.command}"\n`; if (template.fixType) { toml += `fixType = "${template.fixType}"\n`; } if (template.fixCommand) { toml += `fixCommand = "${template.fixCommand}"\n`; } if (template.metricsFormat) { toml += `metricsFormat = "${template.metricsFormat}"\n`; } if (template.metricsPath) { toml += `metricsPath = "${template.metricsPath}"\n`; } return toml; }

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/drewkhoury/devpipe-mcp'

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