detect_code_switching
Identify Hinglish/Tanglish code-switching patterns and calculate language mix ratios to analyze bilingual text composition.
Instructions
Detect Hinglish/Tanglish code-switching with language mix ratios. Cost: $0.003 USDC. Service: indic.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| primary_language | No |
Implementation Reference
- src/index.ts:166-223 (handler)This is a dynamic MCP server. The tool 'detect_code_switching' is not hardcoded but is fetched from a remote registry. The tool call handler resolves any requested tool name by looking it up in the fetched registry and proxying the request to the tool's defined endpoint.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; let registry: Registry; try { registry = await fetchRegistry(); } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Failed to fetch tool registry", detail: String(error) }), }, ], }; } const tool = registry.tools.find((t) => t.name === name); if (!tool) { return { content: [ { type: "text", text: JSON.stringify({ error: `Tool '${name}' not found`, available_tools: registry.tools.map((t) => t.name), }), }, ], }; } try { const result = await callTool(tool, args as Record<string, unknown>); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Tool call failed", tool: name, service: tool.service, detail: String(error), }), }, ], }; } });