Skip to main content
Glama
mmntm

Weblate MCP Server

by mmntm

getComponentChanges

Retrieve recent updates for a specific component in Weblate translation projects by providing the project and component slugs.

Instructions

Get recent changes for a specific component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentSlugYesThe slug of the component
projectSlugYesThe slug of the project

Implementation Reference

  • Main MCP tool handler for getComponentChanges. Fetches changes using WeblateApiService, formats them using formatChangeResult, and returns formatted text response or error.
    @Tool({ name: 'getComponentChanges', description: 'Get recent changes for a specific component', parameters: z.object({ projectSlug: z.string().describe('The slug of the project'), componentSlug: z.string().describe('The slug of the component'), }), }) async getComponentChanges({ projectSlug, componentSlug, }: { projectSlug: string; componentSlug: string; }) { try { const result = await this.weblateApiService.getComponentChanges( projectSlug, componentSlug, ); if (result.results.length === 0) { return { content: [ { type: 'text', text: `No changes found for component "${componentSlug}" in project "${projectSlug}".`, }, ], }; } const changesList = result.results .slice(0, 20) .map(change => this.formatChangeResult(change)) .join('\n\n---\n\n'); return { content: [ { type: 'text', text: `Recent changes in component "${componentSlug}" (${result.count} total):\n\n${changesList}`, }, ], }; } catch (error) { this.logger.error( `Failed to get changes for component ${componentSlug} in project ${projectSlug}`, error, ); return { content: [ { type: 'text', text: `Error getting changes for component "${componentSlug}": ${error.message}`, }, ], isError: true, }; } }
  • Zod schema defining input parameters for the getComponentChanges tool: projectSlug and componentSlug.
    parameters: z.object({ projectSlug: z.string().describe('The slug of the project'), componentSlug: z.string().describe('The slug of the component'), }),
  • WeblateChangesTool (containing getComponentChanges) is registered as a provider in AppModule, making its @Tool methods available via MCP.
    WeblateProjectsTool, WeblateComponentsTool, WeblateLanguagesTool, WeblateTranslationsTool, WeblateChangesTool, WeblateStatisticsTool, ],
  • Helper service method in WeblateChangesService that performs the actual API call to retrieve changes for a specific component using the Weblate client.
    /** * Get changes for a specific component */ async getComponentChanges( projectSlug: string, componentSlug: string ): Promise<{ results: Change[]; count: number; next?: string; previous?: string }> { try { const client = this.weblateClientService.getClient(); const response = await componentsChangesRetrieve({ client, path: { project__slug: projectSlug, slug: componentSlug }, }); const changeList = response.data as any; // Handle different response formats if (Array.isArray(changeList)) { return { results: changeList, count: changeList.length, }; } if (changeList && changeList.results) { return { results: changeList.results || [], count: changeList.count || 0, next: changeList.next || undefined, previous: changeList.previous || undefined, }; } return { results: [], count: 0 }; } catch (error) { this.logger.error( `Failed to get changes for component ${componentSlug} in project ${projectSlug}`, error, ); throw new Error(`Failed to get component changes: ${error.message}`); } }
  • Delegation method in WeblateApiService that forwards the getComponentChanges call to the underlying changesService.
    async getComponentChanges(projectSlug: string, componentSlug: string) { return this.changesService.getComponentChanges(projectSlug, componentSlug); }

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/mmntm/weblate-mcp'

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