reverse_word
Reverse the characters of any word with this tool. Input a word, and it will return the reversed version, ideal for text transformation tasks in the MCP Demo Project.
Instructions
Reverses the characters in a given word
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| word | Yes | The word to reverse |
Implementation Reference
- src/server.ts:90-92 (handler)The core handler function that implements the reverse_word tool logic by splitting the input string into characters, reversing their order, and joining them back.private reverseWord(word: string): string { return word.split("").reverse().join(""); }
- src/sse-server.ts:93-95 (handler)Identical core handler function that implements the reverse_word tool logic in the SSE server.private reverseWord(word: string): string { return word.split("").reverse().join(""); }
- src/server.ts:12-14 (schema)Zod schema used to validate the input arguments for the reverse_word tool.const ReverseWordSchema = z.object({ word: z.string().describe("The word to reverse"), });
- src/server.ts:39-52 (registration)Tool registration in the ListTools response, defining 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,
- src/sse-server.ts:13-15 (schema)Zod schema used to validate the input arguments for the reverse_word tool in SSE server.const ReverseWordSchema = z.object({ word: z.string().describe("The word to reverse"), });