barrel_server_mcp_tools (barrel_server v1.0.0)

View Source

The core MCP tools: databases, documents, BQL, search, the changes feed, and the timeline (branch/merge). Every handler is arity 2; the Ctx carries the authenticated principal, which barrel_server_mcp_auth:allow/3 checks against the database and right each tool touches. Denials come back as isError tool results, not protocol errors: agents recover better from content they can read.

Writes thread provenance through write_opts/2 (actor = subject, session = MCP session or the session argument, source = mcp), the single seam every MCP write shares.

Summary

Functions

branch_create(Args, Ctx)

branch_list(_, Ctx)

changes(Args, Ctx)

db_create(_, Ctx)

db_info(_, Ctx)

db_list(Args, Ctx)

doc_delete(Args, Ctx)

doc_get(_, Ctx)

doc_put(Args, Ctx)

merge(_, Ctx)

query(Args, Ctx)

query_subscribe(Args, Ctx)

query_unsubscribe(_, Ctx)

register_all()

search(Args, Ctx)

unregister_all()

write_opts(Ctx, Args)

-spec write_opts(map(), map()) -> map().

The write options of an MCP write: provenance from the authenticated principal.