Skip to main content
Glama

list_languages

Retrieve all available languages for a translation project to manage multilingual content and streamline localization workflows.

Instructions

List languages in the project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo

Implementation Reference

  • Handler function for the 'list_languages' tool. Resolves project ID, calls POEditor 'languages/list' API endpoint, and returns the result as formatted JSON text.
    async (args) => { const id = requireProjectId(args.project_id ?? null); const res = await poeditor("languages/list", { id: String(id) }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] }; }
  • Zod schema defining the input parameters for the 'list_languages' tool (optional project_id).
    const ListLanguagesInput = z.object({ project_id: z.number().int().positive().optional() });
  • src/server.ts:286-295 (registration)
    Registration of the 'list_languages' tool with the MCP server, including name, description, input schema, and handler function.
    server.tool( "list_languages", "List languages in the project.", ListLanguagesInput.shape, async (args) => { const id = requireProjectId(args.project_id ?? null); const res = await poeditor("languages/list", { id: String(id) }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] }; } );
  • Helper function used by list_languages (and other tools) to resolve or require the project_id from args or env.
    function requireProjectId(argProjectId?: number | null) { const id = argProjectId ?? (PROJECT_ID ? Number(PROJECT_ID) : null); if (!id) throw new Error("project_id is required (either pass it to the tool or set POEDITOR_PROJECT_ID)"); return id; }
  • Core helper function used by list_languages handler to make authenticated API calls to POEditor.
    export async function poeditor(endpoint: string, form: Record<string, string>) { const body = new URLSearchParams({ api_token: API_TOKEN!, ...form }); const { body: resBody } = await request(`${API_BASE}/${endpoint}`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: body.toString() }); const text = await resBody.text(); let json: any; try { json = JSON.parse(text); } catch (e) { throw new Error(`POEditor: invalid JSON response: ${text}`); } const status = json?.response?.status; if (status !== "success") { const code = json?.response?.code; const message = json?.response?.message || "Unknown POEditor error"; throw new Error(`POEditor API error ${code ?? ""}: ${message}`); } return json; }

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/ryan-shaw/poeditor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server