Commit 5042d80
authored
* fix(mcp): map caller-fixable identifier errors to INVALID_ARGUMENT
An invalid KV `store`/`key` (a disallowed byte or over the 512-byte
limit) surfaced from the hyperdb-api layer as `Error::InvalidName` and
fell through the catch-all arm to `INTERNAL_ERROR` — telling an LLM
caller "server bug, give up" for something it supplied and can fix.
Map `InvalidName` and `InvalidTableDefinition` to `INVALID_ARGUMENT`,
which carries a self-correction suggestion; the human-readable message
naming the offending byte or length is unchanged.
`InvalidOperation` is deliberately left out: it is hyperdb-api
caller-API misuse where the caller is this MCP's own Rust code, not the
LLM, so it correctly stays `INTERNAL_ERROR`. A regression test locks in
that distinction.
Caught during the KV MCP smoke run.
* docs(mcp): add on-demand KV smoke-test guide
Capture the manual, tool-driven smoke tests that exercise the eight
`kv_*` tools against a live MCP server: CRUD/upsert, listing and
discovery, value fidelity, destructive semantics, input validation
(now INVALID_ARGUMENT), read-only mode, database routing/isolation,
the LEFT JOIN enrichment pattern, the hidden backing table, and
single-process atomicity. Includes a safety section: the persistent
database may hold real data, so scratch names are `smoke_`-prefixed
and every run ends by verifying the persistent DB is untouched.
The existence-check safety rule is scoped to the target database —
a bare `describe` inspects only the ephemeral primary and `status`
never lists table names, so neither alone protects a persistent write.
Cross-linked from DEVELOPMENT.md's Test section.
* docs(mcp): surface the KV store across all doc surfaces
The key-value scratchpad tools shipped without documentation in the
user-facing MCP README, the LLM-facing get_readme, or the workspace
READMEs. Add coverage in the right places so an LLM told "remember X"
considers kv_set instead of always reaching for CREATE TABLE:
- hyperdb-mcp/README.md: new "### Key-Value Store" tool section; a
"Table or key-value store?" decision rule in Queryable Memory for AI;
the hyper://schema/kv Resources-table row; KV tools in the Features
bullet; and the KV mutator/reader split across all three read-only
enumerations (flag table, Allowed, Blocked).
- src/readme.rs (get_readme): "KV store vs. a custom table" decision
subsection; kv_pop lexicographic-order clarification; a describe
persistent-DB signpost (status reports counts, not names); a
back-link completing the bidirectional cross-link.
- src/server.rs: kv_pop and kv_list_stores #[tool(description)] strings
clarify lexicographic pop order and the no-store-registry behavior.
- README.md (top-level): KvStore / AsyncKvStore Key Features bullet.
Also fix a pre-existing false claim on the --read-only flag-table row
(carried forward on a line this change edited): Hyper-format export is
NOT disabled in read-only mode (export has no writable gate; it's a
read-only file copy), matching the Read-Only "Allowed" list and the
HyperMcpServer::new doc comment.
1 parent 18dc014 commit 5042d80
9 files changed
Lines changed: 525 additions & 8 deletions
File tree
- hyperdb-mcp
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
30 | 45 | | |
31 | 46 | | |
32 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
270 | 273 | | |
271 | 274 | | |
272 | 275 | | |
273 | | - | |
| 276 | + | |
274 | 277 | | |
275 | 278 | | |
276 | 279 | | |
| |||
507 | 510 | | |
508 | 511 | | |
509 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
510 | 549 | | |
511 | 550 | | |
512 | 551 | | |
| |||
601 | 640 | | |
602 | 641 | | |
603 | 642 | | |
| 643 | + | |
604 | 644 | | |
605 | 645 | | |
606 | 646 | | |
| |||
666 | 706 | | |
667 | 707 | | |
668 | 708 | | |
669 | | - | |
670 | | - | |
| 709 | + | |
| 710 | + | |
671 | 711 | | |
672 | 712 | | |
673 | 713 | | |
| |||
0 commit comments