Skip to main content
Glama

create_pet

Generate and adopt a virtual pet by selecting a unique name and type (cat, dog, dragon, or alien) to nurture and evolve in a nostalgic digital environment.

Instructions

Create a new virtual pet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for your new pet
typeYesType of pet: cat, dog, dragon, or alien

Implementation Reference

  • The handler function for the 'create_pet' tool. Validates input parameters (name and type), creates a new pet object based on DEFAULT_PET, initializes timestamps, saves the pet data to file, retrieves an idle animation, and returns a success response with the animation.
    case "create_pet": {
      const name = String(request.params.arguments?.name);
      const type = String(request.params.arguments?.type) as PetType;
    
      if (!name || !type) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: "Name and type are required to create a pet.",
            },
          ],
        };
      }
    
      if (!["cat", "dog", "dragon", "alien"].includes(type)) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: "Pet type must be one of: cat, dog, dragon, alien.",
            },
          ],
        };
      }
    
      // Create a new pet
      pet = {
        ...DEFAULT_PET,
        name,
        type,
        created: Date.now(),
        lastInteraction: Date.now(),
      };
    
      await savePet();
    
      // Get an idle animation for the new pet
      const animation = getIdleAnimation(pet.type);
    
      return {
        content: [
          {
            type: "text",
            text: `Congratulations! You've created a new ${type} named ${name}!\n\n${animation}\n\nMake sure to take good care of your new friend!`,
          },
        ],
      };
    }
  • src/index.ts:220-238 (registration)
    Registration of the 'create_pet' tool in the ListToolsRequestSchema handler, including name, description, and input schema definition for validation.
    {
      name: "create_pet",
      description: "Create a new virtual pet",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name for your new pet",
          },
          type: {
            type: "string",
            enum: ["cat", "dog", "dragon", "alien"],
            description: "Type of pet: cat, dog, dragon, or alien",
          },
        },
        required: ["name", "type"],
      },
    },
Install Server

Other Tools

Related 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/shreyaskarnik/mcpet'

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