get_pets
Retrieve a map of all pets you own in Habitica, including counts for each pet, to track your collection.
Instructions
Get owned pets map.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:249-253 (registration)Tool 'get_pets' is registered in the tools array with name 'get_pets', description 'Get owned pets map.', and an empty inputSchema (no parameters).
{ name: "get_pets", description: "Get owned pets map.", inputSchema: { type: "object", properties: {} }, }, - index.js:431-431 (handler)Handler for get_pets: calls Habitica API GET /user, then extracts data?.items?.pets and formats as JSON text.
get_pets: async () => json((await api("GET", "/user")).data?.items?.pets), - index.js:53-54 (helper)Helper functions: ok() wraps text in MCP content response; json() stringifies an object as pretty-printed JSON.
const ok = (text) => ({ content: [{ type: "text", text }] }); const json = (obj) => ok(JSON.stringify(obj, null, 2)); - index.js:482-492 (handler)The CallToolRequestSchema handler that dispatches tool calls to handlers[name] and returns the result.
server.setRequestHandler(CallToolRequestSchema, async (req) => { const { name, arguments: args = {} } = req.params; const fn = handlers[name]; if (!fn) throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); try { return await fn(args); } catch (err) { if (err instanceof McpError) throw err; throw new McpError(ErrorCode.InternalError, err?.message ?? String(err)); } });