Skip to main content
Glama
mmntm

Weblate MCP Server

by mmntm

getComponentChanges

Retrieve recent changes for a translation component in Weblate by specifying project and component slugs to track modifications.

Instructions

Get recent changes for a specific component

Input Schema

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

Implementation Reference

  • The primary handler for the 'getComponentChanges' tool, decorated with @Tool decorator. Includes schema definition, execution logic to fetch changes from service, format results using helper methods, and error handling.
    @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,
        };
      }
    }
  • Helper service method that implements the core logic for retrieving component changes by calling the Weblate API's componentsChangesRetrieve endpoint.
    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}`);
      }
    }
  • Proxy method in WeblateApiService that delegates getComponentChanges to the underlying changes service.
    async getComponentChanges(projectSlug: string, componentSlug: string) {
      return this.changesService.getComponentChanges(projectSlug, componentSlug);
  • Private helper method used by the handler to format individual change results into a readable string.
    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}`;
    }
  • The WeblateChangesTool class (containing the getComponentChanges handler) is registered as a provider in the AppModule, enabling automatic tool registration via MCP-Nest.
    WeblateChangesTool,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves 'recent changes' but doesn't specify what constitutes 'recent' (timeframe, limit), the format of returned changes, whether it's read-only (implied but not explicit), or any authentication/rate limit considerations. For a tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with zero wasted content. Every word earns its place by conveying essential information about the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a changes retrieval tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'changes' entail (e.g., edits, additions, deletions), the return format, pagination, or error handling. For a tool that likely returns structured change data, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('projectSlug', 'componentSlug') clearly documented in the schema. The description adds no additional parameter semantics beyond implying the tool operates on a component within a project. Since the schema already fully describes the parameters, the baseline score of 3 is appropriate—the description doesn't enhance or contradict the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get recent changes') and target resource ('for a specific component'), which provides a specific verb+resource combination. However, it doesn't distinguish this tool from similar siblings like 'getProjectChanges' or 'listRecentChanges', which likely retrieve changes at different scopes. The purpose is clear but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'getProjectChanges' and 'listRecentChanges' available, the agent has no indication whether this tool is for component-specific changes, project-wide changes, or unfiltered changes. There's no mention of prerequisites, exclusions, or comparative context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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