Skip to main content
Glama
kylekanouse

Demo MCP Server

by kylekanouse

Text Analyzer

analyze-text

Analyze text to extract statistics and insights for processing needs. This tool processes input text to provide measurable data points.

Instructions

Analyze text and provide statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to analyze

Implementation Reference

  • The main handler function that performs comprehensive text analysis, calculating character counts (with and without spaces), word count, sentence count, paragraph count, average words per sentence, and estimated reading time, then formats and returns the results as a text content block.
          const characterCountNoSpaces = text.replace(/\s/g, "").length;
          const wordCount = text.trim().split(/\s+/).filter(word => word.length > 0).length;
          const sentenceCount = text.split(/[.!?]+/).filter(sentence => sentence.trim().length > 0).length;
          const paragraphCount = text.split(/\n\s*\n/).filter(paragraph => paragraph.trim().length > 0).length;
          
          const analysis = [
            `📊 Text Analysis Results:`,
            `Characters: ${characterCount}`,
            `Characters (no spaces): ${characterCountNoSpaces}`,
            `Words: ${wordCount}`,
            `Sentences: ${sentenceCount}`,
            `Paragraphs: ${paragraphCount}`,
            `Average words per sentence: ${sentenceCount > 0 ? (wordCount / sentenceCount).toFixed(2) : "0"}`,
            `Reading time (approx): ${Math.ceil(wordCount / 200)} minutes`
          ].join("\n");
    
          return {
            content: [
              {
                type: "text",
                text: analysis
              }
            ]
          };
        }
      );
    }
  • The Zod-based input schema defining the required 'text' parameter as a string.
      }
    },
    async ({ text }) => {
  • Registers the "analyze-text" tool with the MCP server, providing title, description, input schema, and handler function.
        {
          title: "Text Analyzer",
          description: "Analyze text and provide statistics",
          inputSchema: {
            text: z.string().describe("Text to analyze")
          }
        },
        async ({ text }) => {
          const characterCount = text.length;
          const characterCountNoSpaces = text.replace(/\s/g, "").length;
          const wordCount = text.trim().split(/\s+/).filter(word => word.length > 0).length;
          const sentenceCount = text.split(/[.!?]+/).filter(sentence => sentence.trim().length > 0).length;
          const paragraphCount = text.split(/\n\s*\n/).filter(paragraph => paragraph.trim().length > 0).length;
          
          const analysis = [
            `📊 Text Analysis Results:`,
            `Characters: ${characterCount}`,
            `Characters (no spaces): ${characterCountNoSpaces}`,
            `Words: ${wordCount}`,
            `Sentences: ${sentenceCount}`,
            `Paragraphs: ${paragraphCount}`,
            `Average words per sentence: ${sentenceCount > 0 ? (wordCount / sentenceCount).toFixed(2) : "0"}`,
            `Reading time (approx): ${Math.ceil(wordCount / 200)} minutes`
          ].join("\n");
    
          return {
            content: [
              {
                type: "text",
                text: analysis
              }
            ]
          };
        }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'provide statistics' but doesn't disclose behavioral traits such as what statistics are returned, format of output, performance characteristics, rate limits, or error handling. This leaves significant gaps in understanding how the tool behaves beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a single sentence 'Analyze text and provide statistics', which is front-loaded and wastes no words. However, it could be more structured by specifying key details, but it earns high marks for brevity and clarity within its limited scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what statistics are provided, how results are formatted, or any behavioral context. For a tool with undefined output and no annotations, more detail is needed to make it fully usable by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with one parameter 'text' fully documented in the schema. The description adds no meaning beyond the schema, as it doesn't elaborate on parameter usage, constraints, or examples. Baseline is 3 since the schema does the heavy lifting, but no extra value is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Analyze text and provide statistics' states a general purpose but lacks specificity. It mentions the verb 'analyze' and resource 'text' but doesn't specify what kind of analysis or statistics (e.g., word count, sentiment, readability). It distinguishes from sibling tools (math operations and text transformation) but not clearly from other potential text analysis tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives is provided. The description doesn't mention context, prerequisites, or exclusions. It implies usage for text analysis but doesn't differentiate from other text-related tools like 'transform-text' or specify scenarios where this is preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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/kylekanouse/Test-MCP---DEMO-MCP-Dev-1'

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