Skip to main content
Glama

feed_pet

Feed a Habitica pet by providing the pet key and food key. This action nourishes the pet, helping it grow and gain experience.

Instructions

Feed a pet a piece of food.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
petYesPet key, e.g. Wolf-Base.
foodYesFood key, e.g. Meat.

Implementation Reference

  • Tool definition and input schema for 'feed_pet' — defines the tool name, description, and required parameters 'pet' and 'food' with their types.
    {
      name: "feed_pet",
      description: "Feed a pet a piece of food.",
      inputSchema: {
        type: "object",
        properties: {
          pet: { type: "string", description: "Pet key, e.g. Wolf-Base." },
          food: { type: "string", description: "Food key, e.g. Meat." },
        },
        required: ["pet", "food"],
      },
    },
  • Handler function for 'feed_pet' — sends a POST request to the Habitica API /user/feed/{pet}/{food} endpoint and returns a success message.
    feed_pet: async ({ pet, food }) => {
      await api("POST", `/user/feed/${encodeURIComponent(pet)}/${encodeURIComponent(food)}`);
      return ok(`Fed ${food} to ${pet}.`);
    },
  • index.js:482-492 (registration)
    Tool registration via CallToolRequestSchema handler — dispatches tool calls by name to the handlers map, which includes 'feed_pet'.
    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));
      }
    });
  • Helper function 'api' and 'ok' used by the feed_pet handler — api() makes HTTP requests to the Habitica API, ok() formats the text response.
    async function api(method, path, body) {
      const url = `${API_BASE}${path}`;
      const headers = {
        "x-api-user": USER_ID,
        "x-api-key": API_TOKEN,
        "x-client": `${USER_ID}-${APP_ID}`,
        "Content-Type": "application/json",
      };
      const res = await fetch(url, {
        method,
        headers,
        body: body === undefined ? undefined : JSON.stringify(body),
      });
      const text = await res.text();
      let payload;
      try {
        payload = text ? JSON.parse(text) : {};
      } catch {
        payload = { raw: text };
      }
      if (!res.ok) {
        const msg = payload?.message || payload?.error || res.statusText;
        throw new McpError(
          ErrorCode.InternalError,
          `Habitica API ${res.status}: ${msg}`,
        );
      }
      return payload;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It does not disclose side effects (e.g., food consumption, pet status changes), required permissions, or whether the pet must be owned. The minimal verb 'feed' implies a state change but lacks detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It front-loads the core action and resource, earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter tool with no output schema, the description provides the basic action. However, it lacks procedural context (e.g., inventory requirements) that would aid an agent in real-world use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing examples (e.g., 'Wolf-Base', 'Meat') that add context beyond parameter names. However, the description does not explain constraints or format, so it meets the baseline without exceeding it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Feed a pet a piece of food') and identifies the resource (pet and food). It distinguishes from siblings like 'hatch_pet' or 'get_pets' by making the specific feeding action obvious.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., 'buy_item' for food, 'get_pets' to check pet existence). There is no mention of prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/leon-jarvis1/habitca_mcp'

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