Skip to main content
Glama

feed_pet

Provide food to your digital companion on MCPet by selecting snack, meal, or feast to nurture its growth and monitor its evolution.

Instructions

Feed your virtual pet

Input Schema

NameRequiredDescriptionDefault
foodYesType of food: snack, meal, or feast

Input Schema (JSON Schema)

{ "properties": { "food": { "description": "Type of food: snack, meal, or feast", "enum": [ "snack", "meal", "feast" ], "type": "string" } }, "required": [ "food" ], "type": "object" }

Implementation Reference

  • The handler function that executes the feed_pet tool. It validates the food type (snack, meal, or feast), updates the pet's hunger and health stats based on the food, calls updatePetStats and savePet, retrieves an eating animation, and returns a response with updated stats.
    case "feed_pet": { if (!pet) { return { content: [ { type: "text", text: "You don't have a pet yet! Use the create_pet tool to create one.", }, ], }; } const food = String(request.params.arguments?.food); if (!["snack", "meal", "feast"].includes(food)) { return { isError: true, content: [ { type: "text", text: "Food type must be one of: snack, meal, feast.", }, ], }; } updatePetStats(); // Different foods provide different amounts of satiety let hungerIncrease = 0; let healthChange = 0; let response = ""; if (food === "snack") { hungerIncrease = 10; healthChange = 0; response = `${pet.name} enjoys the small snack. Not very filling, but tasty!`; } else if (food === "meal") { hungerIncrease = 30; healthChange = 5; response = `${pet.name} happily eats the nutritious meal and feels satisfied.`; } else if (food === "feast") { hungerIncrease = 60; healthChange = -5; // Too much food is unhealthy response = `${pet.name} devours the enormous feast! Almost too much food!`; } pet.stats.hunger = Math.min(100, pet.stats.hunger + hungerIncrease); pet.stats.health = Math.min( 100, Math.max(0, pet.stats.health + healthChange) ); await savePet(); // Get appropriate animation for the food type const animation = getEatingAnimation(pet.type, food); return { content: [ { type: "text", text: `${response}\n\n${animation}\n\nHunger: ${pet.stats.hunger.toFixed( 0 )}/100\nHealth: ${pet.stats.health.toFixed(0)}/100`, }, ], }; }
  • src/index.ts:248-262 (registration)
    The registration of the feed_pet tool in the listTools response, including its name, description, and input schema definition.
    { name: "feed_pet", description: "Feed your virtual pet", inputSchema: { type: "object", properties: { food: { type: "string", enum: ["snack", "meal", "feast"], description: "Type of food: snack, meal, or feast", }, }, required: ["food"], }, },
  • The input schema for the feed_pet tool, defining the required 'food' parameter with allowed values: snack, meal, feast.
    inputSchema: { type: "object", properties: { food: { type: "string", enum: ["snack", "meal", "feast"], description: "Type of food: snack, meal, or feast", }, }, required: ["food"], },

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