UNPKG

it-tools-mcp

Version:

Full MCP 2025-06-18 compliant server with 121+ IT tools, logging, ping, progress tracking, cancellation, and sampling utilities

44 lines (43 loc) 1.59 kB
import { z } from "zod"; export function registerTextToUnicodeNames(server) { server.registerTool("show_unicode_names", { description: "Convert text to Unicode character names", inputSchema: { text: z.string().describe("Text to convert to Unicode names") }, // VS Code compliance annotations annotations: { title: "Show Unicode Names", description: "Convert text to Unicode character names", readOnlyHint: true } }, async ({ text }) => { const unicodeNames = [...text].map(char => { const codePoint = char.codePointAt(0); if (!codePoint) return char; const hex = codePoint.toString(16).toUpperCase().padStart(4, '0'); // Basic Unicode character name mapping for common characters const basicNames = { 32: 'SPACE', 33: 'EXCLAMATION MARK', 63: 'QUESTION MARK', 64: 'COMMERCIAL AT', 65: 'LATIN CAPITAL LETTER A', 66: 'LATIN CAPITAL LETTER B', 97: 'LATIN SMALL LETTER A', 98: 'LATIN SMALL LETTER B', // Add more as needed }; const name = basicNames[codePoint] || 'UNKNOWN CHARACTER'; return `${char} (U+${hex}: ${name})`; }).join('\n'); return { content: [{ type: "text", text: `Unicode Character Names: ${unicodeNames}` }] }; }); }