Skip to main content
Glama
mmntm

Weblate MCP Server

by mmntm

getComponentLanguageProgress

Retrieve translation progress statistics for all languages in a Weblate component to monitor localization status and identify areas needing attention.

Instructions

Get translation progress for all languages in a component

Input Schema

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

Implementation Reference

  • Main handler for the MCP tool 'getComponentLanguageProgress'. Includes @Tool decorator with name, description, Zod input schema, and the async function that delegates to statistics service, formats output, and handles errors.
    @Tool({
      name: 'getComponentLanguageProgress',
      description: 'Get translation progress for all languages in a component',
      parameters: z.object({
        projectSlug: z.string().describe('The slug of the project'),
        componentSlug: z.string().describe('The slug of the component'),
      }),
    })
    async getComponentLanguageProgress({
      projectSlug,
      componentSlug,
    }: {
      projectSlug: string;
      componentSlug: string;
    }) {
      try {
        const progress = await this.statisticsService.getComponentLanguageProgress(
          projectSlug,
          componentSlug,
        );
    
        return {
          content: [
            {
              type: 'text',
              text: this.formatComponentLanguageProgress(projectSlug, componentSlug, progress),
            },
          ],
        };
      } catch (error) {
        this.logger.error(
          `Failed to get component language progress for ${projectSlug}/${componentSlug}`,
          error,
        );
        return {
          content: [
            {
              type: 'text',
              text: `Error getting component language progress: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining input parameters for the 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'),
    }),
  • Core service method implementing the logic to fetch translation progress: lists project languages and retrieves statistics for each in the component.
    async getComponentLanguageProgress(projectSlug: string, componentSlug: string) {
      try {
        // Get available languages for the project
        const languages = await this.languagesService.listLanguages(projectSlug);
    
        // Get translation statistics for each language
        const languageProgress = await Promise.all(
          languages.map(async (language) => {
            try {
              const stats = await this.getTranslationStatistics(
                projectSlug,
                componentSlug,
                language.code,
              );
              return {
                language: language.name,
                code: language.code,
                statistics: stats,
              };
            } catch (error) {
              this.logger.warn(
                `Failed to get translation stats for ${language.code} in ${componentSlug}`,
                error,
              );
              return {
                language: language.name,
                code: language.code,
                statistics: null,
                error: error.message,
              };
            }
          }),
        );
    
        return languageProgress;
      } catch (error) {
        this.logger.error(
          `Failed to get component language progress for ${projectSlug}/${componentSlug}`,
          error,
        );
        throw error;
      }
    }
  • Formatter helper that converts language progress data into a formatted Markdown string with progress bars and statistics per language.
      private formatComponentLanguageProgress(
        projectSlug: string,
        componentSlug: string,
        progress: any[],
      ): string {
        let result = `## 🌐 Language Progress: ${projectSlug}/${componentSlug}\n\n`;
    
        progress.forEach((lang: any, index: number) => {
          if (lang.statistics) {
            const stats = lang.statistics;
            const formatPercent = (value: any) => {
              return typeof value === 'number' ? `${value.toFixed(1)}%` : 'N/A';
            };
    
            const progressBar = this.generateProgressBar(stats.translated_percent || 0);
    
            result += `**${index + 1}. ${lang.language}** (${lang.code})
    ${progressBar} ${formatPercent(stats.translated_percent)}
    - ✅ Approved: ${formatPercent(stats.approved_percent)}
    - 📝 Total: ${stats.total || 'N/A'} | Translated: ${stats.translated || 'N/A'}
    
    `;
          } else {
            result += `**${index + 1}. ${lang.language}** (${lang.code})
    - ❌ Error: ${lang.error || 'Unable to load statistics'}
    
    `;
          }
        });
    
        return result;
      }
  • Registration of the WeblateStatisticsTool class (containing the tool handler) as a provider in the NestJS AppModule.
    WeblateStatisticsTool,
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 mentions 'Get translation progress' but doesn't specify whether this is a read-only operation, if it requires authentication, rate limits, or what the output format looks like (e.g., structured data, percentages). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 is appropriately sized and front-loaded, making it easy to understand at a glance.

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 lack of annotations and output schema, the description is insufficient for a tool that likely returns complex data (translation progress across languages). It doesn't explain the return values, data structure, or any behavioral traits, leaving the agent with incomplete context to use the tool 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?

The input schema has 100% description coverage, with clear documentation for both parameters ('projectSlug' and 'componentSlug'). The description adds no additional semantic context beyond what the schema provides, such as explaining what a 'slug' represents or how these parameters relate to the translation progress. Baseline 3 is appropriate when the schema does the heavy lifting.

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 verb ('Get') and resource ('translation progress for all languages in a component'), making the purpose unambiguous. However, it doesn't explicitly differentiate from siblings like 'getComponentStatistics' or 'getLanguageStatistics', which might also provide related progress metrics, so it doesn't reach the highest score.

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 such as 'getComponentStatistics' or 'getLanguageStatistics', nor does it mention prerequisites or exclusions. It merely states what the tool does without contextual usage information.

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