Skip to main content
Glama
mmntm

Weblate MCP Server

by mmntm

listLanguages

Retrieve available languages for a Weblate translation project to manage multilingual content effectively.

Instructions

List languages available in a specific project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectSlugYesThe slug of the project

Implementation Reference

  • The main handler function for the 'listLanguages' MCP tool. It uses @Tool decorator specifying name, description, input schema with Zod, fetches languages via service, formats as markdown list, handles errors, and returns structured content.
    @Tool({
      name: 'listLanguages',
      description: 'List languages available in a specific project',
      parameters: z.object({
        projectSlug: z.string().describe('The slug of the project'),
      }),
    })
    async listLanguages({ projectSlug }: { projectSlug: string }) {
      try {
        const languages = await this.weblateApiService.listLanguages(projectSlug);
    
        return {
          content: [
            {
              type: 'text',
              text: `Languages in project "${projectSlug}":\n\n${languages
                .map(
                  (l) =>
                    `- **${l.name}** (${l.code})`,
                )
                .join('\n')}`,
            },
          ],
        };
      } catch (error) {
        this.logger.error(`Failed to list languages for ${projectSlug}`, error);
        return {
          content: [
            {
              type: 'text',
              text: `Error listing languages for project "${projectSlug}": ${error.message}`,
            },
          ],
          isError: true,
        };
      }
  • Zod schema defining the input parameters for the listLanguages tool: projectSlug as string.
    parameters: z.object({
      projectSlug: z.string().describe('The slug of the project'),
    }),
  • Registration of tool classes including WeblateLanguagesTool in the AppModule providers. Since they use @Tool decorator, NestJS/MCP auto-registers them.
      WeblateProjectsTool,
      WeblateComponentsTool,
      WeblateLanguagesTool,
      WeblateTranslationsTool,
      WeblateChangesTool,
      WeblateStatisticsTool,
    ],
  • Helper method in WeblateApiService that delegates listLanguages call to the underlying languages service.
    async listLanguages(projectSlug: string): Promise<Language[]> {
      return this.languagesService.listLanguages(projectSlug);
    }
  • Core helper service implementing the API call to retrieve languages for a project using Weblate client, with response parsing and error handling.
    async listLanguages(projectSlug: string): Promise<Language[]> {
      try {
        const client = this.weblateClientService.getClient();
        const response = await projectsLanguagesRetrieve({
          client,
          path: { slug: projectSlug }
        });
        
        // Handle different response formats
        const languages = response.data as any;
        
        if (Array.isArray(languages)) {
          return languages;
        }
        
        // If it's a paginated response
        if (languages && languages.results && Array.isArray(languages.results)) {
          return languages.results;
        }
        
        // If it's a single language, wrap it in an array
        if (languages && typeof languages === 'object') {
          return [languages];
        }
        
        return [];
      } catch (error) {
        this.logger.error(
          `Failed to list languages for project ${projectSlug}`,
          error,
        );
        throw new Error(`Failed to list languages: ${error.message}`);
      }
    }
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. It states it's a list operation, implying read-only behavior, but doesn't disclose any behavioral traits such as pagination, rate limits, authentication needs, or what the output format looks like. This leaves significant gaps for a tool with no annotation coverage.

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 any wasted 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 incomplete. It doesn't explain what the list output includes (e.g., language codes, names, statuses) or any behavioral aspects like error handling. For a tool with no structured data support, more context is needed to be fully helpful.

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 the single parameter 'projectSlug' well-documented in the schema. The description adds no additional meaning beyond implying the parameter is required for scoping, which is already clear from the schema. Baseline 3 is appropriate as 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 'List' and the resource 'languages available in a specific project', which provides a specific purpose. However, it doesn't explicitly differentiate from sibling tools like 'listComponents' or 'listProjects', which follow a similar pattern, so it doesn't fully distinguish itself.

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 minimal context by specifying 'in a specific project', but offers no guidance on when to use this tool versus alternatives like 'getLanguageStatistics' or 'searchStringInProject'. There are no explicit when/when-not instructions or named alternatives mentioned.

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