Skip to main content
Glama
wubbyweb

MCP Demo Project

by wubbyweb

reverse_word

Reverse the characters in any word to create its mirror image. This tool transforms input text by flipping character order for various applications.

Instructions

Reverses the characters in a given word

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wordYesThe word to reverse

Implementation Reference

  • Core handler function executing the reverse_word tool logic: splits the word into characters, reverses the array, and joins back into a string.
    private reverseWord(word: string): string {
      return word.split("").reverse().join("");
    }
  • Zod schema for validating input to the reverse_word tool, requiring a 'word' string.
    const ReverseWordSchema = z.object({
      word: z.string().describe("The word to reverse"),
    });
  • src/server.ts:39-52 (registration)
    Registration of the reverse_word tool in the ListToolsRequestHandler, including name, description, and input schema.
    {
      name: "reverse_word",
      description: "Reverses the characters in a given word",
      inputSchema: {
        type: "object",
        properties: {
          word: {
            type: "string",
            description: "The word to reverse",
          },
        },
        required: ["word"],
      },
    } as Tool,
  • Core handler function executing the reverse_word tool logic: splits the word into characters, reverses the array, and joins back into a string (SSE variant).
    private reverseWord(word: string): string {
      return word.split("").reverse().join("");
    }
  • Zod schema for validating input to the reverse_word tool, requiring a 'word' string (SSE variant).
    const ReverseWordSchema = z.object({
      word: z.string().describe("The word to reverse"),
    });
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/wubbyweb/mcp-demo'

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