get-target-languages
Retrieve a list of supported target languages for translation using the DeepL API, enabling accurate selection for multilingual text processing.
Instructions
Get list of available target languages for translation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'get-target-languages' tool. It calls the helper getDeeplLanguages with 'target' parameter to fetch available target languages from the DeepL API.async function getTargetLanguages() { return await getDeeplLanguages('target'); }
- workshops/deepl-simple-js/deepl-simple.js:46-50 (registration)Registration of the 'get-target-languages' tool using McpServer.tool(). It has no input schema and points to the getTargetLanguages handler.server.tool( 'get-target-languages', 'Get list of available target languages for translation', getTargetLanguages );
- Shared helper function that retrieves either source or target languages from the DeepL API based on the sourceOrDestination parameter ('target' for this tool). Formats the result using mcpTextContentify.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); } }