getProjectChanges
Track and retrieve recent changes for a specific translation project using the project slug on the Weblate MCP Server.
Instructions
Get recent changes for a specific project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectSlug | Yes | The slug of the project |
Implementation Reference
- src/tools/changes.tool.ts:80-127 (handler)The primary MCP tool handler for 'getProjectChanges'. It validates input with Zod, fetches project changes from WeblateApiService, formats the results using helper methods like formatChangeResult, handles empty results and errors, and returns structured content blocks.@Tool({ name: 'getProjectChanges', description: 'Get recent changes for a specific project', parameters: z.object({ projectSlug: z.string().describe('The slug of the project'), }), }) async getProjectChanges({ projectSlug }: { projectSlug: string }) { try { const result = await this.weblateApiService.getProjectChanges(projectSlug); if (result.results.length === 0) { return { content: [ { type: 'text', text: `No changes found for 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 project "${projectSlug}" (${result.count} total):\n\n${changesList}`, }, ], }; } catch (error) { this.logger.error(`Failed to get changes for project ${projectSlug}`, error); return { content: [ { type: 'text', text: `Error getting changes for project "${projectSlug}": ${error.message}`, }, ], isError: true, }; } }
- src/tools/changes.tool.ts:83-85 (schema)Zod schema defining the input parameters for the getProjectChanges tool: requires a projectSlug string.parameters: z.object({ projectSlug: z.string().describe('The slug of the project'), }),
- src/app.module.ts:74-80 (registration)Registration of the WeblateChangesTool class in the NestJS AppModule providers array, which enables the @Tool-decorated methods including getProjectChanges to be exposed as MCP tools.WeblateProjectsTool, WeblateComponentsTool, WeblateLanguagesTool, WeblateTranslationsTool, WeblateChangesTool, WeblateStatisticsTool, ],
- Helper service function in WeblateChangesService that performs the actual API call to retrieve project changes using the Weblate client's projectsChangesRetrieve method, handles paginated or array responses.async getProjectChanges( projectSlug: string ): Promise<{ results: Change[]; count: number; next?: string; previous?: string }> { try { const client = this.weblateClientService.getClient(); const response = await projectsChangesRetrieve({ client, path: { slug: projectSlug }, }); 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 project ${projectSlug}`, error); throw new Error(`Failed to get project changes: ${error.message}`); } }
- Delegation method in WeblateApiService that forwards the getProjectChanges request to the underlying WeblateChangesService.async getProjectChanges(projectSlug: string) { return this.changesService.getProjectChanges(projectSlug); }