Skip to main content
Glama

play_with_pet

Engage in interactive activities like ball, chase, or puzzle to play with your virtual pet on MCPet, fostering its growth and companionship in a nostalgic digital environment.

Instructions

Play with your virtual pet

Input Schema

NameRequiredDescriptionDefault
activityYesType of play activity: ball, chase, or puzzle

Input Schema (JSON Schema)

{ "properties": { "activity": { "description": "Type of play activity: ball, chase, or puzzle", "enum": [ "ball", "chase", "puzzle" ], "type": "string" } }, "required": [ "activity" ], "type": "object" }

Implementation Reference

  • Executes the play_with_pet tool: validates activity, updates pet's happiness and energy stats based on activity type, saves pet data, retrieves playing animation, and returns response with updated stats.
    case "play_with_pet": { if (!pet) { return { content: [ { type: "text", text: "You don't have a pet yet! Use the create_pet tool to create one.", }, ], }; } const activity = String(request.params.arguments?.activity); if (!["ball", "chase", "puzzle"].includes(activity)) { return { isError: true, content: [ { type: "text", text: "Activity type must be one of: ball, chase, puzzle.", }, ], }; } updatePetStats(); let happinessIncrease = 0; let energyDecrease = 0; let response = ""; if (activity === "ball") { happinessIncrease = 20; energyDecrease = 10; response = `${pet.name} chases the ball with excitement! Good exercise!`; } else if (activity === "chase") { happinessIncrease = 30; energyDecrease = 25; response = `You and ${pet.name} play an energetic game of chase! So much fun!`; } else if (activity === "puzzle") { happinessIncrease = 15; energyDecrease = 5; response = `${pet.name} enjoys the mental stimulation of solving puzzles!`; } pet.stats.happiness = Math.min( 100, pet.stats.happiness + happinessIncrease ); pet.stats.energy = Math.max(0, pet.stats.energy - energyDecrease); await savePet(); // Get appropriate animation for the activity type const animation = getPlayingAnimation(pet.type, activity); return { content: [ { type: "text", text: `${response}\n\n${animation}\n\nHappiness: ${pet.stats.happiness.toFixed( 0 )}/100\nEnergy: ${pet.stats.energy.toFixed(0)}/100`, }, ], }; }
  • Defines the tool schema including name, description, and input schema requiring 'activity' parameter with enum values.
    name: "play_with_pet", description: "Play with your virtual pet", inputSchema: { type: "object", properties: { activity: { type: "string", enum: ["ball", "chase", "puzzle"], description: "Type of play activity: ball, chase, or puzzle", }, }, required: ["activity"], }, },
  • src/index.ts:217-298 (registration)
    Registers the play_with_pet tool in the list of available tools returned by ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { 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"], }, }, { name: "check_pet", description: "Check on your virtual pet's status", inputSchema: { type: "object", properties: {}, required: [], }, }, { 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"], }, }, { name: "play_with_pet", description: "Play with your virtual pet", inputSchema: { type: "object", properties: { activity: { type: "string", enum: ["ball", "chase", "puzzle"], description: "Type of play activity: ball, chase, or puzzle", }, }, required: ["activity"], }, }, { name: "clean_pet", description: "Clean your virtual pet", inputSchema: { type: "object", properties: {}, required: [], }, }, { name: "put_to_bed", description: "Put your virtual pet to sleep to restore energy", inputSchema: { type: "object", properties: {}, required: [], }, }, ], }; });

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