Skip to main content
Glama
gitlab.ts3.76 kB
import { DevOpsApiClient } from '../api/index.js'; /** * GitLab CI-related MCP tools */ export class GitLabTools { constructor(private client: DevOpsApiClient) {} /** * Search for GitLab CI reference YAML files by keyword */ async searchReferences(keyword: string): Promise<string> { try { const response = await this.client.searchGitLabReferences(keyword); if (!response.success || !response.data) { return `Error: ${response.error || 'Failed to search GitLab CI references'}`; } if (response.data.length === 0) { return `No GitLab CI references found for keyword: "${keyword}"`; } const results = response.data .map((ref, index) => { const parts = [ `${index + 1}. ${ref.name}`, ref.description ? ` Description: ${ref.description}` : null, ref.category ? ` Category: ${ref.category}` : null, ref.path ? ` Path: ${ref.path}` : null, ]; return parts.filter(Boolean).join('\n'); }) .join('\n\n'); return `Found ${response.data.length} GitLab CI reference(s) for "${keyword}":\n\n${results}`; } catch (error) { return `Error searching GitLab CI references: ${error instanceof Error ? error.message : String(error)}`; } } /** * Get versions for a specific GitLab CI reference */ async getReferenceVersions(referenceName: string): Promise<string> { try { const response = await this.client.getGitLabReferenceVersions(referenceName); if (!response.success || !response.data) { return `Error: ${response.error || 'Failed to get GitLab CI reference versions'}`; } if (response.data.length === 0) { return `No versions found for GitLab CI reference: "${referenceName}"`; } const results = response.data .map((version, index) => { const parts = [ `${index + 1}. ${version.version}${version.deprecated ? ' (DEPRECATED)' : ''}`, version.releaseDate ? ` Release Date: ${version.releaseDate}` : null, version.changelog ? ` Changelog: ${version.changelog}` : null, ]; return parts.filter(Boolean).join('\n'); }) .join('\n\n'); return `Found ${response.data.length} version(s) for "${referenceName}":\n\n${results}`; } catch (error) { return `Error getting GitLab CI reference versions: ${error instanceof Error ? error.message : String(error)}`; } } /** * Get GitLab CI custom pipeline information */ async getPipelineInfo(pipelineName: string): Promise<string> { try { const response = await this.client.getGitLabPipeline(pipelineName); if (!response.success || !response.data) { return `Error: ${response.error || 'Failed to get GitLab CI pipeline information'}`; } const pipeline = response.data; const parts = [ `Pipeline: ${pipeline.name}`, pipeline.description ? `\nDescription: ${pipeline.description}` : null, pipeline.stages && pipeline.stages.length > 0 ? `\nStages:\n${pipeline.stages.map((s, i) => ` ${i + 1}. ${s}`).join('\n')}` : null, pipeline.variables && Object.keys(pipeline.variables).length > 0 ? `\nVariables:\n${Object.entries(pipeline.variables) .map(([key, value]) => ` - ${key}: ${value}`) .join('\n')}` : null, pipeline.template ? `\nTemplate:\n${pipeline.template}` : null, ]; return parts.filter(Boolean).join('\n'); } catch (error) { return `Error getting GitLab CI pipeline information: ${error instanceof Error ? error.message : String(error)}`; } } }

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/pointware/devops-mcp'

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