fleet-memory/hindsight-api-slim/hindsight_api
Philipp Oppolzer c5273f5fd4
fix: coerce JSON-string tags to list in MemoryItem and MCP tools (#682)
MCP tool bridges sometimes serialize JSON arrays as strings during
transport, e.g. '["a", "b"]' arrives as the literal string '["a", "b"]'
instead of a native JSON array. This causes Pydantic to reject the
input with a validation error.

Add defensive coercion at two layers:

1. HTTP API (http.py): Pydantic field_validator on MemoryItem.tags
   with mode="before" that parses JSON strings back into lists.
2. MCP tools (mcp_tools.py): Same coercion in build_content_dict
   before tags reach the Pydantic model.

A plain non-JSON string is wrapped in a single-element list.
Correctly-formatted input is passed through unchanged.

Co-authored-by: Philipp <philipp@Philipps-MacBook-Pro.local>
2026-03-25 14:16:47 +01:00
..
admin feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
alembic Fix pg_trgm unavailability causing startup crash and silent retain failures (#626) (#649) 2026-03-23 09:18:59 +01:00
api fix: coerce JSON-string tags to list in MemoryItem and MCP tools (#682) 2026-03-25 14:16:47 +01:00
engine fix: return metadata in recall responses (#680) 2026-03-25 11:24:18 +01:00
extensions feat(extensions): add context enrichment to OperationValidatorExtension (#639) 2026-03-23 08:57:02 +01:00
webhooks feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
worker Fix orphaned batch_retain parents when child fails via unhandled exception (#618) 2026-03-19 14:55:26 +01:00
__init__.py Release v0.4.20 2026-03-24 09:19:14 +01:00
banner.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
config.py feat: remove hardcoded default models from integrations (#670) 2026-03-24 17:20:15 +01:00
config_resolver.py feat(retain): verbatim, chunks modes and named retain strategies (#593) 2026-03-17 18:08:25 +01:00
daemon.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
main.py Add wall-clock timeout to reflect operations (#643) 2026-03-23 09:19:26 +01:00
mcp_local.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
mcp_tools.py fix: coerce JSON-string tags to list in MemoryItem and MCP tools (#682) 2026-03-25 14:16:47 +01:00
metrics.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
migrations.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
models.py fix: MCP tool calls fail when MCP_AUTH_TOKEN and TENANT_API_KEY differ (#635) 2026-03-20 18:36:05 +01:00
pg0.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
server.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
tracing.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
utils.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00