fleet-memory/hindsight-api/hindsight_api
DK09876 f641b30d83
feat: add mental model CRUD tools to MCP server (#337)
* Add mental model CRUD tools to MCP server

Expose mental models (pinned reflections) as 6 new MCP tools:
- list_mental_models: List with optional tag filtering
- get_mental_model: Get by ID
- create_mental_model: Create with async content generation
- update_mental_model: Update name/source_query/tags
- delete_mental_model: Delete by ID
- refresh_mental_model: Re-run source query to update content

Both multi-bank (bank_id param) and single-bank modes supported,
following the same patterns as existing retain/recall/reflect tools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: include mental model tools in single-bank MCP mode and update tests

The single-bank mode tool set was hardcoded to only retain/recall/reflect,
excluding the new mental model tools. Updated all 3 test layers (unit,
routing, HTTP integration) to assert mental model tool exposure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update extension test tool count for mental model tools

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: move mental model usage metering into engine for MCP support

Mental model validation hooks (validate_mental_model_get, validate_mental_model_refresh)
were only called in REST HTTP handlers, not in the engine. MCP tools call engine methods
directly, so usage metering was skipped entirely for MCP mental model operations.

Moved pre-validation and post-completion hooks into memory_engine.py (matching the
retain/recall/reflect pattern) and removed the duplicate code from http.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove double validation from create_mental_model and add internal checks

- Remove pre-validation from create_mental_model since callers always call
  submit_async_refresh_mental_model next (which validates), preventing
  double credit checks
- Add is_internal checks to mental model metering validators (matching
  the existing pattern for recall/reflect) so background worker tasks
  skip billing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:40:43 +01:00
..
admin feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
alembic feat: support markdown in reflect and mental models (#307) 2026-02-06 10:49:13 +01:00
api feat: add mental model CRUD tools to MCP server (#337) 2026-02-10 22:40:43 +01:00
engine feat: add mental model CRUD tools to MCP server (#337) 2026-02-10 22:40:43 +01:00
extensions doc: prepare doc for 0.4.10 (#325) 2026-02-09 11:42:37 +01:00
worker Fix: load operation validator extension in worker process (#280) 2026-02-02 14:45:40 -05:00
__init__.py Release v0.4.10 2026-02-09 11:44:20 +01:00
banner.py fix: do not log db user/password (#312) 2026-02-09 10:15:03 +01:00
config.py feat: add otel traceability (#330) 2026-02-10 12:20:48 +01:00
daemon.py feat: improve openclaw and hindisght-embed params (#279) 2026-02-03 09:39:04 +01:00
main.py feat: add otel traceability (#330) 2026-02-10 12:20:48 +01:00
mcp_local.py feat(mcp): add timestamp to retain (#190) 2026-01-23 16:00:43 +01:00
mcp_tools.py feat: add mental model CRUD tools to MCP server (#337) 2026-02-10 22:40:43 +01:00
metrics.py chore: remove dead code (#245) 2026-01-30 09:16:32 +01:00
migrations.py fix(helm): improve appVersion usage (#326) 2026-02-09 11:35:08 +01:00
models.py Add user_initiated flag to RequestContext for async task attribution (#338) 2026-02-10 22:37:42 +01:00
pg0.py feat: support vertex as llm provider (#233) 2026-01-29 16:13:57 -05:00
server.py Fix: Load extensions in server.py for multi-worker deployments (#155) 2026-01-13 17:55:33 +01:00
tracing.py feat: add otel traceability (#330) 2026-02-10 12:20:48 +01:00
utils.py fix(helm): improve appVersion usage (#326) 2026-02-09 11:35:08 +01:00