getChangesByUser
Retrieve recent translation changes made by a specific user in Weblate projects to track contributions and review modifications.
Instructions
Get recent changes by a specific user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | Yes | Username to filter by | |
| limit | No | Number of changes to return (default: 20) |
Implementation Reference
- src/tools/changes.tool.ts:191-245 (handler)The primary handler for the 'getChangesByUser' tool. This method is decorated with @Tool, defines its schema, fetches changes using the WeblateApiService, formats the results with helper functions, and returns a structured content response or handles errors.@Tool({ name: 'getChangesByUser', description: 'Get recent changes by a specific user', parameters: z.object({ user: z.string().describe('Username to filter by'), limit: z.number().optional().describe('Number of changes to return (default: 20)').default(20), }), }) async getChangesByUser({ user, limit = 20, }: { user: string; limit?: number; }) { try { const result = await this.weblateApiService.getChangesByUser(user, limit); if (result.results.length === 0) { return { content: [ { type: 'text', text: `No changes found for user "${user}".`, }, ], }; } const changesList = result.results .slice(0, limit) .map(change => this.formatChangeResult(change)) .join('\n\n---\n\n'); return { content: [ { type: 'text', text: `Recent changes by user "${user}" (${result.count} total):\n\n${changesList}`, }, ], }; } catch (error) { this.logger.error(`Failed to get changes by user ${user}`, error); return { content: [ { type: 'text', text: `Error getting changes by user "${user}": ${error.message}`, }, ], isError: true, }; } }
- src/app.module.ts:78-78 (registration)Registration of the WeblateChangesTool class in the AppModule providers array, which enables automatic registration of all @Tool methods including getChangesByUser with the MCP server.WeblateChangesTool,
- src/app.module.ts:53-53 (registration)The getChangesByUser tool is explicitly listed in the MCP server instructions string provided to the McpModule.- getChangesByUser: Get recent changes by a specific user
- src/tools/changes.tool.ts:247-254 (helper)Helper method used by the handler to format each change into a readable string with action, user, time, and target details.private formatChangeResult(change: Change): string { const timestamp = change.timestamp ? new Date(change.timestamp).toLocaleString() : 'Unknown'; const actionDescription = this.getActionDescription(change.action || 0); const user = change.user || 'Unknown user'; const target = change.target || 'N/A'; return `**${actionDescription}**\n**User:** ${user}\n**Time:** ${timestamp}\n**Target:** ${target}`; }
- Underlying service helper that implements getChangesByUser by calling listRecentChanges with user filter, ultimately querying the Weblate API.async getChangesByUser( user: string, limit: number = 50 ): Promise<{ results: Change[]; count: number; next?: string; previous?: string }> { try { return this.listRecentChanges(limit, user); } catch (error) { this.logger.error(`Failed to get changes by user ${user}`, error); throw new Error(`Failed to get changes by user: ${error.message}`); } }