Skip to content

Navigation Menu

Sign in
Sign up

feat(mcp): add memory_get and memory_query tools - #8

Open
barakplasma wants to merge 1 commit into
sqliteai:main from
barakplasma:add-memory-get-query-tools
Open

feat(mcp): add memory_get and memory_query tools #8
barakplasma wants to merge 1 commit into
sqliteai:main from
barakplasma:add-memory-get-query-tools

Conversation

@barakplasma

@barakplasma barakplasma commented May 23, 2026

Copy link
Copy Markdown

Summary

  • memory_get(hash) — returns the full dbmem_content row for a content hash from search results: hash, path, context, value, created_at, last_accessed. Useful when memory_search snippets are too short.
  • memory_query(query) — executes an arbitrary SELECT against the memory database. Read-only enforcement via PRAGMA query_only = ON on a dedicated connection (SQLite engine-level, not string matching).

Test plan

  • TestGetReturnsFullContent — inserts a row, verifies all fields appear in JSON output
  • TestGetNotFound — verifies error returned for missing hash
  • TestQuerySelectWorks — verifies SELECT returns expected rows as JSON
  • TestQueryRejectsWrites — verifies INSERT fails under query_only
  • TestToolNames — updated to include both new tools
  • TestToolsListMapping — count check still passes (tools/list matches ToolNames)

All 11 tests pass: go test ./internal/memory/... ./internal/mcp/...

🤖 Generated with Claude Code

memory_get(hash) returns the full dbmem_content row (hash, path, context,
value, created_at, last_accessed) for a given content hash from search results.
memory_query(query) executes an arbitrary SELECT against the memory database.
Read-only safety is enforced at the SQLite engine level via PRAGMA query_only=ON
on a dedicated connection, rather than a string-prefix check.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /