Skip to content

feat(clients): add stats() to the Python and TypeScript clients #552

Description

@jy7lsna

Problem

Both official clients expose only health, recall, search, write, but the server has a read-only stats endpoint (GET /api/v1/stats, core-api/src/core_api/routes/stats.py) useful for dashboards and self-introspection, requiring no elevated trust at default scope.

Proposed solution

add stats() to clients/python/src/memclaw_client/client.py and clients/typescript/src/index.ts, mirroring the endpoint's query params (scope, memory_type, status, fleet_id, include_deleted); add tests in both existing test files following the mocked-transport patterns; add a README section to each client.

Alternatives considered

Calling GET /api/v1/stats directly with httpx/fetch: works, but duplicates the auth-header and error-handling logic the clients already encapsulate, and every consumer reinvents it.

  • Using the MCP memclaw_stats tool: only available to MCP-connected agents, not to plain SDK consumers (dashboards, scripts, CI).
  • Adding the full remaining endpoint surface (list/manage/doc) at once: much larger review burden; stats() is the smallest read-only step toward parity and sets the pattern.

Affected surface

New surface (not currently exposed)

Are you willing to contribute?

No, but I'm available to discuss

Additional context

No response

Pre-flight

  • I searched existing issues and Discussions for duplicates.
  • I read the Public API & Stability section to understand the SemVer contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerskind/featureNew capability or enhancement to an existing one.status/needs-triageAwaiting initial triage. Auto-applied by issue templates.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions