Command line / AI agents
AI agents
tinystore mcp lets an AI agent read a store through the Model Context
Protocol, on stdin and stdout. By default its tools only read: an agent can
find why a job failed, which lines a request logged and what a row holds, and
it can change nothing. --write adds the tools that write, one operation
each, only those it names.
claude mcp add tinystore -- tinystore mcp ./data
claude mcp add tinystore -- tinystore mcp ./data --write kv_set,jobs_addAny MCP client takes it the same way: the command is tinystore, its
arguments mcp and the store's directory.
Tools
| Tool | Takes | Gives |
|---|---|---|
status | nothing | the store's files and sizes, its server, its node |
logs | since, level, grep, stream, limit | the latest lines and events, newest last; 50, 200 at most |
kv_get | bucket, key, database | one value |
kv_list | bucket, branch, database, limit, after | a bucket's keys and values, in key order; 200 a page, then next |
jobs_list | queue, prefix, state, database, limit, after | jobs with their state, attempts and last error; 200 a page, then next |
sql_query | database, query | the rows of one statement that reads, 200 at most |
search_list | nothing | the store's search indexes, with their documents |
- Every tool reads as every read of the command line does, beside whoever holds the directory (contract CLI-01).
sql_queryruns on a read-only connection: a statement that writes is refused. A query that gives more than 200 rows is refused too, rather than cut, so that an agent never takes the first 200 rows for all of them: it pages withlimitandoffset.kv_listandjobs_listanswer a list. When more follow than one call answers, they answer{ "entries": [...], "next": "..." }and{ "jobs": [...], "next": "..." }instead: passnextback asafterto read the next page. A bare list is the whole rest, so an agent never takes the first 200 for all of them (contract MCP-10).jobs_listwithstate: 'failed'and no prefix gives a queue's failed jobs, the last failed first: where a question about an error usually starts.- A bucket or a queue the program opened from a database,
db.bucket(…)ordb.queue(…), lives in that database's file rather than inkv.dborjobs.db:kv_get,kv_listandjobs_listread it withdatabase, as{ "queue": "reminders", "database": "app" }.
What an agent can answer
Why did the reply to message 41 fail?
The agent reads the queue's failed jobs, finds the one for message 41 and its
last error, reads the request's log lines around that time by grep, and the
message's row by sql_query. Each step is a read; none needs a person to copy
anything into the chat.
Writing
An agent that can write can also write the wrong thing, confidently, and a
prompt injection in a log line it reads can ask it to. So --write names
each tool that writes:
tinystore mcp ./data --write kv_set,jobs_add # these two, and no other
tinystore mcp ./data --write all # every tool below| Tool | Takes | Removes or replaces |
|---|---|---|
kv_set | bucket, key, value, as, ttl, database | no |
kv_delete | bucket, key, database | yes |
jobs_add | queue, job, id, delay, database | no |
jobs_cancel | queue, id, database | yes |
files_put | set, path, text, type | yes |
files_delete | set, path | yes |
events_append | stream, name, fields, level, id | no |
channels_publish | channel, message, under | no |
config_update | config, changes, as {"model.max_tokens": "2048"} | no |
config_reset | config, path | yes |
sql_exec | database, statement | yes |
- Each tool is one operation and is marked as writing, and as destructive where it removes or replaces something, so the agent's host asks its person for each, as Claude Code does for any tool not yet allowed.
- A tool
--writedoesn't name is not offered, and a call of it is refused. - They write as every write of the command line does.
- A flag is no boundary for an agent that also has a shell: it can run
tinystore kv setitself. Give an agent--writewhere its host decides what it may run, not as a sandbox.
See also
- The command line.
- Your own MCP server: the same server, tools and
--writein your Rust program, with these tools mounted on your store. - Let an AI agent read the store in the Handbook.