Skip to main content
Glama

IT Tools MCP Server

index.ts1.44 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerDistinctWords(server: McpServer) { server.registerTool("analyze_distinct_words", { description: "Count distinct words in text and show their frequency", inputSchema: { text: z.string().describe("Text to analyze for distinct words") }, // VS Code compliance annotations annotations: { title: "Analyze Distinct Words", description: "Count distinct words in text and show their frequency", readOnlyHint: true } }, async ({ text }) => { // Remove punctuation and split into words const cleanedText = text.replace(/[^\w\s]/g, ' ').toLowerCase(); const words = cleanedText.split(/\s+/).filter(word => word.length > 0); // Count word frequencies const wordCount: Record<string, number> = {}; words.forEach(word => { wordCount[word] = (wordCount[word] || 0) + 1; }); // Sort by frequency (descending) const sortedWords = Object.entries(wordCount) .sort(([,a], [,b]) => b - a); const result = sortedWords.map(([word, count]) => `${word}: ${count}`).join('\n'); return { content: [{ type: "text", text: `Distinct Words Analysis: Total unique words: ${sortedWords.length} Total words: ${words.length} Word frequencies: ${result}` }] }; } ); }

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/wrenchpilot/it-tools-mcp'

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