Repository navigation
Tools Reference
The gateway strictly exposes nine closed tools via standard Model Context Protocol (MCP) JSON-RPC 2.0 stdio transport.
All schemas enforce additionalProperties: false (JSON Schema) and extra="forbid" (Pydantic v2). Any unrecognized parameter returns an immediate INVALID_ARGUMENT error envelope.
| Tool Name | Lifecycle State | Type | Description |
|---|---|---|---|
select_notebook |
DISCOVERY_ONLY |
State Transition | Locks session to a single notebook and saves to .notebook_mcp.json. |
list_notebooks |
All | Read-Only | Lists allowlisted notebooks and returns project configuration status. |
get_notebook_metadata |
ACTIVE_DISPATCH |
Read-Only | Retrieves full notebook metadata, sources count, and timestamps. |
list_sources |
ACTIVE_DISPATCH |
Read-Only | Lists all ingested sources, document types, and processing states. |
query_notebook |
ACTIVE_DISPATCH |
Grounded Q&A | Streams grounded answers with normalized Unicode citation offsets. |
add_source |
ACTIVE_DISPATCH |
Write Mutation | Ingests text, URLs, Google Drive documents, or binary files via Scotty. |
create_note |
ACTIVE_DISPATCH |
Write Mutation | Creates a user note within the active notebook. |
list_notes |
ACTIVE_DISPATCH |
Read-Only | Lists user notes with loud upstream schema drift detection. |
delete_note |
ACTIVE_DISPATCH |
Write Mutation | Deletes a user note by unique ID. |
Enforces ADR-011 single-notebook session lock, transitioning the gateway from DISCOVERY_ONLY to ACTIVE_DISPATCH.
{
"notebook_id": "string (optional; UUIDv4 format)",
"title": "string (optional; human-readable notebook title)",
"save_for_project": "boolean (optional; default: true)"
}Note: Exactly one of notebook_id or title must be provided.
- Resolves human-readable titles against allowlisted notebooks.
- If
save_for_projectistrue, persists selection into.notebook_mcp.jsonin the current working directory. - Subsequent calls during the same session with a different notebook fail with
SESSION_LOCKED.
Lists notebooks authorized in allowlist.json.
{
"page_size": "integer (optional; default: 20, max: 100)",
"cursor": "string (optional)"
}Surfaces project_config from .notebook_mcp.json and an actionable user_prompt directing the AI assistant to confirm notebook selection at the start of each chat session.
Fetches metadata for the active notebook via rLM1Ne.
{
"notebook_id": "string (optional; automatically overwritten by locked session ID)"
}Lists all sources ingested into the active notebook.
{
"page_size": "integer (optional; default: 50, max: 100)",
"cursor": "string (optional)"
}Streams grounded natural-language answers backed by notebook citations via GenerateFreeFormStreamed.
{
"question": "string (required)",
"request_key": "string (required; client-supplied idempotency key)",
"source_ids": "array of strings (optional; target query to specific sources)"
}-
Strict Grounding Barrier (M-06): Returns
UNGROUNDED_RESPONSEif model output contains zero citations. -
Scoped Pre-Query Readiness (M-10): Validates readiness only for targeted
source_ids. - Unicode Citation Normalization (ADR-004): Converts Google V8 UTF-16 offsets to Unicode code point spans.
-
Mid-Stream Error Deltas (P-01): Emits
STREAM_SEVEREDframe if transport disconnects mid-stream.
Ingests content into the active notebook.
{
"idempotency_key": "string (required; unique client token)",
"source": {
"type": "text | url | drive | file (required)",
"title": "string (required for text/file)",
"content": "string (required for text; raw text body)",
"url": "string (required for url; http/https or YouTube URL)",
"doc_id": "string (required for drive; Google Drive document ID)",
"file_path": "string (required for file; local absolute path)",
"mime_type": "string (optional; e.g. application/pdf)"
},
"wait_until_ready": "boolean (optional; default: false)"
}- Pre-Flight Account Identity Guard (P-03): Asserts active email before dispatching mutations.
-
Scotty 3-Step Resumable Upload (M-02, P-02): Slices files into
$\le 512\text{ KiB}$ chunks with session URL caching and query resumption. - Full Jitter Exponential Backoff (ADR-006): Polls readiness without saturating network.
Creates a user note within the active notebook.
{
"title": "string (required)",
"content": "string (required; markdown formatted)",
"idempotency_key": "string (required)"
}Lists user notes from the active notebook.
{
"page_size": "integer (optional; default: 50, max: 100)",
"cursor": "string (optional)"
}-
Loud Schema Canary (M-05): Returns
UPSTREAM_SCHEMA_DRIFTif upstream array shapes deviate, preventing silent empty list returns.
Permanently deletes a user note.
{
"note_id": "string (required)",
"idempotency_key": "string (required)"
}All errors across IPC and MCP stdio adhere to the following contract:
{
"ok": false,
"error": {
"code": "ALLOWLIST_DENIED | AUTH_REQUIRED | MUTATION_UNKNOWN | INVALID_ARGUMENT | SESSION_UNLOCKED | SESSION_LOCKED | INTERNAL | NOT_FOUND | STREAM_SEVERED | UPSTREAM_SCHEMA_DRIFT",
"message": "Human-readable failure description.",
"retryable": false
},
"_meta": {
"traceparent": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"mcp_correlation_id": "client-supplied-request-key"
}
}Version: v4.2.0-STRICT
Status: Grounded & Verified