Skip to content

Usage stats display broken: [object Object] and undefined for PAID tier accountsΒ #1

@saviski

Description

@saviski

Bug: Usage stats display broken β€” [object Object] and undefined for PAID tier accounts

Description

All tools that display API usage stats (check_usage, search_icons, etc.) show malformed output when using a PAID tier account:

πŸ“ˆ API Usage: [object Object]/undefined (monthly)

And in check_usage:

Monthly Limit: undefined requests
Used: [object Object] requests
Remaining: NaN requests
Usage Rate: NaN%

Root Cause

The code assumes monthly.usage is a number and monthly.limit is a defined number, but the actual Noun Project API v2 /client/usage response returns monthly.usage as an object and monthly.limit as undefined β€” likely because PAID accounts have no hard limit.

Affected lines:

  • dist/tools/search.js:92 β€” `${usage_limits.monthly.usage}/${usage_limits.monthly.limit}`
  • dist/tools/usage.js:61–62 β€” const usage = monthly.usage; const limit = monthly.limit;

Environment

  • NOUN_API_TIER=PAID
  • Package: @alisaitteke/noun-mcp (latest via npx -y)
  • All core functionality (search, get icon, download) works correctly β€” only the usage display is broken

Expected Behavior

Either display the raw usage object properly, or gracefully handle undefined limits (e.g. show "Unlimited" for PAID tier).

Suggested Fix

Log the raw API response from GET /v2/client/usage and update the destructuring in formatUsageInfo and formatSearchResults to match the actual response shape. For PAID tier, treat null/undefined limit as unlimited.


Debugged with assistance from Claude Code (claude-sonnet-4-6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions