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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for your new pet | |
| type | Yes | Type of pet: cat, dog, dragon, or alien |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"description": "Name for your new pet",
"type": "string"
},
"type": {
"description": "Type of pet: cat, dog, dragon, or alien",
"enum": [
"cat",
"dog",
"dragon",
"alien"
],
"type": "string"
}
},
"required": [
"name",
"type"
],
"type": "object"
}
Implementation Reference
- src/index.ts:306-356 (handler)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"], }, },