Bug Report: `GET /v2/habits/journal` does not return `bad` habits

## Summary

The `/v2/habits/journal` endpoint  and its MCP equivalent `list-habits-by-date`  silently omits habits with `"type": "bad"` from the response, even when those habits are active, non-archived, and scheduled for the queried date.

---

## Environment

- **API version:** v2  
- **Base URL:** `https://api.habitify.me/v2`  
- **MCP Server:** `https://mcp.habitify.me/mcp`  
- **Authentication:** `X-API-Key` header  

---

## Steps to Reproduce

### 1. Confirm the `bad` habit exists and is active

```bash
curl -s "https://api.habitify.me/v2/habits?type=bad" \
  -H "X-API-Key: YOUR_API_KEY"
```

**Response (200 OK):**
```json
{
  "data": [
    {
      "id": "67553EEB-F669-4EA6-BC0B-XXXXXXXXXXXX",
      "name": "Avoid too much Cofee",
      "type": "bad",
      "isArchived": false,
      "occurrence": { "type": "daily" },
      "startDate": "2026-04-14",
      "goals": [
        {
          "periodicity": "daily",
          "value": 4,
          "unit": "cup",
          "isActive": true
        }
      ]
    }
  ]
}
```

The habit is `active`, `non-archived`, `daily`, and started on `2026-04-14`.

---

### 2. Query the journal for the same date

```bash
curl -s "https://api.habitify.me/v2/habits/journal?date=2026-04-14" \
  -H "X-API-Key: YOUR_API_KEY"
```

**Response (200 OK):**
```json
{
  "data": [
    { "id": "8C641B01-...", "name": "Leitura da Biblia", "type": "good" },
    { "id": "98C38CCF-...", "name": "3L de água por dia", "type": "good"  },
    { "id": "4C67DF71-...", "name": "Sono",               "type": "good"  }
  ]
}
```

**The `bad` habit `"Avoid too much Cofee"` is missing.** The same result is observed for `date=2026-04-15` (next day).

---

### 3. Same behavior via MCP

When calling the `list-habits-by-date` tool through the MCP server:

```json
{
  "method": "tools/call",
  "params": {
    "name": "list-habits-by-date",
    "arguments": { "date": "2026-04-14" }
  }
}
```

The response mirrors the REST API  the `bad` habit is not present.

---

## Expected Behavior

Per the API documentation:

> *"Retrieve **all** your habits with their completion status and progress for a specific date."*

The response should include **both** `good` and `bad` habits scheduled for the queried date.

---

## Actual Behavior

Only `good` habits are returned. Habits with `"type": "bad"` are silently excluded.

---

## Impact

This makes it **impossible** for AI assistants or third-party integrations using the MCP `list-habits-by-date` tool to:

- Display `bad` habits in a daily overview
- Log progress toward a `bad` habit (e.g., counting coffee cups)
- Mark a `bad` habit as `failed` based on daily tracking

The habit ID can be obtained from `GET /habits?type=bad`, but this requires a separate call and hardcoding IDs in client applications  which defeats the purpose of the journal endpoint.

---

## Suggested Fix

Option A: Include `bad` habits in the journal response by default (aligns with the documented behavior).

Option B: Add an optional `type` query parameter to the journal endpoint:
```
GET /v2/habits/journal?date=2026-04-14&type=bad
```

Option C: Add a corresponding MCP tool  e.g., `list-bad-habits-by-date`  as a short-term workaround.

---

## Additional Notes

- The `GET /v2/habits` endpoint correctly supports `?type=bad` filtering and works as expected.
- The issue appears to be isolated to the `/habits/journal` endpoint and the `list-habits-by-date` MCP tool.

Share update with 0 linked conversations as well

Upvoters
Status

In Review

Board

🐞 Bug Report

Tags

High Priority

Date

About 4 hours ago

Author

An Anonymous User

Subscribe to post

Get notified by email when there are changes.