list_cows
Display all available cow characters for ASCII art generation, including dragons, penguins, and skeletons to customize your text-based illustrations.
Instructions
List all available cow characters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:184-204 (handler)The main handler function that retrieves the list of available cow characters by running 'cowsay -l' or using the cowsay library API, with fallback list.export async function listCows(): Promise<string[]> { try { const { stdout } = await execAsync(`npx cowsay@1.6.0 -l`); return stdout.split('\n').filter(Boolean); } catch (error) { try { const cowsList = await new Promise<string[]>((resolve, reject) => { cowsay.list((error, cow_names) => { if (error) { reject(error); } else { resolve(cow_names || []); } }); }); return cowsList; } catch (error) { return ['default', 'small', 'tux', 'moose', 'sheep', 'dragon', 'elephant', 'skeleton', 'stimpy']; } } }
- src/tools.ts:157-165 (schema)Tool schema definition for 'list_cows', specifying no input parameters.export const LIST_COWS: Tool = { name: 'list_cows', title: 'List Cows', description: 'List all available cow characters.', inputSchema: { type: 'object', properties: {}, }, };
- src/index.ts:107-126 (registration)Registers the 'list_cows' tool on the MCP server, providing schema from LIST_COWS and a handler that validates access, calls listCows(), and formats the response as text content.mcp_server.registerTool("list_cows", { title: LIST_COWS.title, description: LIST_COWS.description, inputSchema: {}, }, async () => { // 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 result = await listCows(); return { content: [ { type: "text", text: `Available cow characters: ${result.join(', ')}` } ], }; })