it-tools-mcp
Version:
MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.
37 lines (34 loc) • 1.18 kB
JavaScript
import { z } from "zod";
export function registerTextStats(server) {
server.registerTool("analyze_text_stats", {
inputSchema: {
text: z.string().describe("Text to analyze"),
},
// VS Code compliance annotations
annotations: {
title: "Analyze Text Stats",
readOnlyHint: true
}
}, async ({ text }) => {
const lines = text.split('\n');
const words = text.trim().split(/\s+/).filter(word => word.length > 0);
const characters = text.length;
const charactersNoSpaces = text.replace(/\s/g, '').length;
const paragraphs = text.split(/\n\s*\n/).filter(para => para.trim().length > 0);
return {
content: [
{
type: "text",
text: `Text Statistics:
Characters: ${characters}
Characters (no spaces): ${charactersNoSpaces}
Words: ${words.length}
Lines: ${lines.length}
Paragraphs: ${paragraphs.length}
Reading time: ~${Math.ceil(words.length / 200)} minutes (200 WPM)
Speaking time: ~${Math.ceil(words.length / 150)} minutes (150 WPM)`,
},
],
};
});
}