Command line / AI agents
On this page

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.

sh
claude mcp add tinystore -- tinystore mcp ./data
claude mcp add tinystore -- tinystore mcp ./data --write kv_set,jobs_add

Any MCP client takes it the same way: the command is tinystore, its arguments mcp and the store's directory.

Tools

ToolTakesGives
statusnothingthe store's files and sizes, its server, its node
logssince, level, grep, stream, limitthe latest lines and events, newest last; 50, 200 at most
kv_getbucket, key, databaseone value
kv_listbucket, branch, database, limit, aftera bucket's keys and values, in key order; 200 a page, then next
jobs_listqueue, prefix, state, database, limit, afterjobs with their state, attempts and last error; 200 a page, then next
sql_querydatabase, querythe rows of one statement that reads, 200 at most
search_listnothingthe 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_query runs 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 with limit and offset.
  • kv_list and jobs_list answer a list. When more follow than one call answers, they answer { "entries": [...], "next": "..." } and { "jobs": [...], "next": "..." } instead: pass next back as after to 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_list with state: '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(…) or db.queue(…), lives in that database's file rather than in kv.db or jobs.db: kv_get, kv_list and jobs_list read it with database, 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:

sh
tinystore mcp ./data --write kv_set,jobs_add   # these two, and no other
tinystore mcp ./data --write all               # every tool below
ToolTakesRemoves or replaces
kv_setbucket, key, value, as, ttl, databaseno
kv_deletebucket, key, databaseyes
jobs_addqueue, job, id, delay, databaseno
jobs_cancelqueue, id, databaseyes
files_putset, path, text, typeyes
files_deleteset, pathyes
events_appendstream, name, fields, level, idno
channels_publishchannel, message, underno
config_updateconfig, changes, as {"model.max_tokens": "2048"}no
config_resetconfig, pathyes
sql_execdatabase, statementyes
  • 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 --write doesn'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 set itself. Give an agent --write where its host decides what it may run, not as a sandbox.

See also

Edit this page on GitHub Updated 27 November 2026

esc
↑↓ navigate ↵ open ⇥ filter 0 results