@translated/lara-mcp
Version:
Lara API official MCP server
21 lines (20 loc) • 847 B
JavaScript
import { z } from "zod/v4";
import { detectResultSchema } from "./_schemas.js";
export const detectLanguageOutputSchema = detectResultSchema;
export const detectLanguageSchema = z.object({
text: z
.union([z.string(), z.array(z.string()).max(128)])
.describe("The text to detect the language of. Can be a single string or an array of strings (up to 128 elements)."),
hint: z
.string()
.optional()
.describe("Optional language code hint to guide detection (e.g., 'en-EN')."),
passlist: z
.array(z.string())
.optional()
.describe("Optional list of language codes to restrict detection results to."),
});
export async function detectLanguage(args, lara) {
const { text, hint, passlist } = detectLanguageSchema.parse(args);
return lara.detect(text, hint, passlist);
}