Skip to main content
Glama
mrseanchow

Cowsay MCP Server

by mrseanchow

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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'];
            }
        }
    }
  • 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(', ')}`
                }
            ],
        };
    })

Tool Definition Quality

Score is being calculated. Check back soon.

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/mrseanchow/cowsay-mcp'

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