cowthink
Generate ASCII art of a thinking cow with custom messages. Use various characters like dragons, penguins, or skeletons to create fun text-based art for documentation or entertainment.
Instructions
Generate ASCII art of a cow thinking something.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cow | No | The cow character to use. | default |
| message | Yes | The message for the cow to think. | What to think about? |
Implementation Reference
- src/index.ts:87-105 (handler)The registered handler function for the 'cowthink' tool. It validates server access, normalizes the input message and character based on config, calls the generateCowthink helper, and returns the result as MCP content.}, async ({ message, character }) => { // Validate server access if (!validateServerAccess(config.serverToken)) { throw new Error("Server access validation failed. Please provide a valid serverToken."); } // Apply user preferences from config const searchText = config.caseSensitive ? message : message.toLowerCase(); const searchChar = config.caseSensitive ? character : character.toLowerCase(); // Count occurrences of the specific character const result = await generateCowthink(searchText, searchChar); return { content: [ { type: "text", text: result } ], }; })
- src/index.ts:167-181 (helper)Core helper function that generates the cowthink ASCII art. Primarily uses npx cowsay with -T '\' option, falls back to cowsay.think library.export async function generateCowthink(message: string, cow: string): Promise<string> { try { const cowOption = cow !== 'default' ? `-f ${cow}` : ''; const escapedMessage = message.replace(/'/g, "\\'"); const { stdout } = await execAsync(`echo '${escapedMessage}' | npx cowsay@1.6.0 -T '\\' ${cowOption}`); return stdout; } catch (error) { try { const options = cow !== 'default' ? { f: cow } : {}; return cowsay.think({ text: message, ...options }); } catch (err) { throw new Error(`Failed to generate cowthink output: ${err instanceof Error ? err.message : String(err)}`); } } }
- src/tools.ts:80-155 (schema)Detailed TypeScript type definition (Tool schema) for the cowthink tool, including all possible input parameters for cowsay think mode.export const COWTHINK: Tool = { name: 'cowthink', title: 'Cow Think', description: 'Generate ASCII art of a cow thinking something.', inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'The message for the cow to think.', default: 'What to think about?' }, character: { type: 'string', description: 'The cow character to use.', enum: ['default', 'small', 'tux', 'moose', 'sheep', 'dragon', 'elephant', 'skeleton', 'stimpy'], default: 'default' }, e: { type: 'string', description: 'Custom eyes for the cow.', default: 'oo' }, T: { type: 'string', description: 'Custom tongue for the cow.' }, r: { type: 'boolean', description: 'Use a random cow character.', default: false }, b: { type: 'boolean', description: 'Borg mode - use borg face.', default: false }, d: { type: 'boolean', description: 'Dead mode - use dead face.', default: false }, g: { type: 'boolean', description: 'Greedy mode - use greedy face.', default: false }, p: { type: 'boolean', description: 'Paranoia mode - use paranoia face.', default: false }, s: { type: 'boolean', description: 'Stoned mode - use stoned face.', default: false }, t: { type: 'boolean', description: 'Tired mode - use tired face.', default: false }, w: { type: 'boolean', description: 'Youthful mode - use youthful face.', default: false }, y: { type: 'boolean', description: 'Wired mode - use wired face.', default: false } }, required: ['message'] }, };
- src/index.ts:80-86 (registration)Tool registration call on the MCP server, specifying name 'cowthink', title/description from tools.ts, and Zod-based input schema (simplified). The handler follows inline.mcp_server.registerTool("cowthink", { title: COWTHINK.title, description: COWTHINK.description, inputSchema: { message: z.string().describe('The message for the cow to think.'), character: z.string().optional().default('default').describe('The cow character to use.') },