Skip to main content
Glama
kylekanouse

Demo MCP Server

by kylekanouse

Text Transformer

transform-text

Convert text to uppercase, lowercase, capitalize words, reverse strings, or count words using this text transformation tool from the Demo MCP Server.

Instructions

Transform text case and format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to transform
operationYesTransformation operation to apply

Implementation Reference

  • Handler function that executes the transform-text tool logic. Takes input text and operation (uppercase, lowercase, capitalize, reverse, word-count), performs the transformation, and returns the result as text content.
    async ({ text, operation }) => {
      let result: string;
      
      switch (operation) {
        case "uppercase":
          result = text.toUpperCase();
          break;
        case "lowercase":
          result = text.toLowerCase();
          break;
        case "capitalize":
          result = text.split(" ")
            .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
            .join(" ");
          break;
        case "reverse":
          result = text.split("").reverse().join("");
          break;
        case "word-count":
          const wordCount = text.trim().split(/\s+/).filter(word => word.length > 0).length;
          result = `Word count: ${wordCount}`;
          break;
        default:
          result = "Unknown operation";
      }
    
      return {
        content: [
          {
            type: "text",
            text: result
          }
        ]
      };
    }
  • Zod-based input schema for the transform-text tool, validating 'text' as string and 'operation' as one of the specified enum values.
    inputSchema: {
      text: z.string().describe("Text to transform"),
      operation: z.enum([
        "uppercase",
        "lowercase", 
        "capitalize",
        "reverse",
        "word-count"
      ]).describe("Transformation operation to apply")
    }
  • Registration of the 'transform-text' tool on the MCP server, including name, metadata (title, description), input schema, and handler function.
    server.registerTool(
      "transform-text",
      {
        title: "Text Transformer",
        description: "Transform text case and format",
        inputSchema: {
          text: z.string().describe("Text to transform"),
          operation: z.enum([
            "uppercase",
            "lowercase", 
            "capitalize",
            "reverse",
            "word-count"
          ]).describe("Transformation operation to apply")
        }
      },
      async ({ text, operation }) => {
        let result: string;
        
        switch (operation) {
          case "uppercase":
            result = text.toUpperCase();
            break;
          case "lowercase":
            result = text.toLowerCase();
            break;
          case "capitalize":
            result = text.split(" ")
              .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
              .join(" ");
            break;
          case "reverse":
            result = text.split("").reverse().join("");
            break;
          case "word-count":
            const wordCount = text.trim().split(/\s+/).filter(word => word.length > 0).length;
            result = `Word count: ${wordCount}`;
            break;
          default:
            result = "Unknown operation";
        }
    
        return {
          content: [
            {
              type: "text",
              text: result
            }
          ]
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on traits like whether transformations are reversible, performance characteristics, error handling, or output format. For a tool with 2 parameters and no output schema, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is extremely concise at three words, front-loaded with the core purpose ('Transform text case and format'). Every word earns its place without redundancy or unnecessary elaboration, making it efficient and easy to parse.

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 the tool's moderate complexity (2 parameters, no annotations, no output schema), the description is incomplete. It lacks information on behavioral traits, output format, and usage guidelines, which are essential for an agent to invoke it correctly without structured support from annotations or output schema.

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?

The schema description coverage is 100%, with clear descriptions for both parameters ('text' and 'operation'), including an enum for 'operation'. The description adds no additional parameter semantics beyond what the schema provides, such as examples or edge cases, so it meets the baseline for high schema coverage.

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

Purpose4/5

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

The description 'Transform text case and format' clearly states the verb ('transform') and resource ('text'), specifying the domain of operations (case and format). It distinguishes from sibling tools like 'analyze-text' by focusing on transformation rather than analysis, though it doesn't explicitly differentiate from all siblings.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'analyze-text' for different text operations or specify contexts where transformation is preferred over other text-handling tools, leaving usage entirely implicit.

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