Skip to main content
Glama

get-source-languages

Retrieve a list of available source languages for translation using the DeepL API. Identify supported languages to ensure accurate and efficient text translation workflows.

Instructions

Get list of available source languages for translation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the get-source-languages tool. It delegates to getDeeplLanguages('source') to retrieve available source languages from the DeepL API.
    async function getSourceLanguages() { return await getDeeplLanguages('source'); }
  • Registration of the get-source-languages tool on the MCP server, specifying name, description, and handler function.
    server.tool( 'get-source-languages', 'Get list of available source languages for translation', getSourceLanguages );
  • Core helper function that calls the appropriate DeepL API method to get source or target languages, formats the response as MCP text content, and handles errors.
    async function getDeeplLanguages(sourceOrDestination) { const method = sourceOrDestination == 'source' ? 'getSourceLanguages' : 'getTargetLanguages'; try { const languages = await deeplClient[method](); return mcpTextContentify(languages.map(JSON.stringify)); } catch (error) { return handleError(error); } }
  • Utility function to wrap strings or array of strings into the MCP expected content object structure with type 'text'.
    function mcpTextContentify(param) { if (typeof(param) != 'string' && !Array.isArray(param)) { throw new Error('mcpTextContentify() expects a string or an array of strings'); } const strings = typeof(param) == 'string' ? [param] : param; const contentObjects = strings.map( str => ({ type: "text", text: str }) ); return { content: contentObjects }; }

Other Tools

Related 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/DeepLcom/deepl-mcp-server'

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