Cotton code
3000 lines · 121.7 KB · JSONRaw
{ "source": "generated by pnpm rules:catalogue from crates/cotton-tools/src/mcp/object_catalogue.rs (the served tools' scope, annotations and words from catalogue.rs); never edited by hand", "protocolVersion": "2025-06-18", "serverInfo": {  "name": "cotton",  "title": "Cotton",  "version": "1.0.0" }, "kernel": "Cotton is this person's own database of typed records, served to the assistants they connected. How to work with them:\n- Start with the project this work belongs to: brief { repoUrl, machine } binds a repo to its project, or list_projects then brief { project }.\n- recall before assuming what they think; remember (with a project) transcribes what they said; log_session at the end of a turn.\n- Tools are data: a tool's instructions come with its definition in list_tools; read them before you write its records.", "staticKernel": "Cotton is this person's own database of typed records — todos, calendar events, notes, journal pages, people, places and meetings they recorded. Search it before assuming you do not know something about their life, and prefer creating records here over telling them to write things down themselves.", "tools": [  {   "name": "get_record",   "title": "Get one record",   "description": "Fetch a note or a memory entry in full by its kind and id: a note's body, kind, journal day, project and authorship; a memory entry as recall answers one, with its projects. Any other record — a todo, an event, a person, a meeting, a document, a row of a table the user made — is read with get_record_by_table { table, id }, and the file a record keeps with get_media.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "kind": {      "type": "string",      "enum": [       "note",       "memory"      ],      "description": "What the record is: a note (a journal entry and a thought are notes) or a memory entry."     },     "id": {      "type": "string",      "description": "The record's id."     }    },    "required": [     "kind",     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "create_todo",   "title": "Create a todo",   "description": "Add a todo to the user's default list. Give a due only when the user named a day or a time; a todo with no due date is filed, not scheduled. A todo can be due on a DAY (dueDate alone — 'a day is enough') or at a time on that day (dueDate + dueTime); dueAt is the raw-instant alternative. For a REPEATING todo ('payment on the 2nd of every month') pass rrule — a due is then required and is the first occurrence; later occurrences appear as their time comes.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "title": {      "type": "string"     },     "dueDate": {      "type": "string",      "description": "The day it is due, YYYY-MM-DD in the user's zone. On its own this is a date-only todo; add dueTime for an hour. Not with dueAt."     },     "dueTime": {      "type": "string",      "description": "The clock time on dueDate, HH:mm (24-hour) in the user's zone. Needs dueDate."     },     "timezone": {      "type": "string",      "description": "IANA zone dueDate/dueTime are read in (e.g. Asia/Kolkata). Omit it and the user's own zone is used."     },     "dueAt": {      "type": "string",      "description": "ISO 8601 instant, when you already hold the exact moment. Prefer dueDate/dueTime. Not with dueDate."     },     "notes": {      "type": "string"     },     "rrule": {      "type": "string",      "description": "iCal RRULE to repeat the todo (FREQ=DAILY/WEEKLY/MONTHLY/YEARLY, with INTERVAL/COUNT/UNTIL/BYDAY). Monthly/yearly recur on dueAt's day; months without it are skipped."     },     "mark": {      "type": "string",      "enum": [       "cake",       "plane",       "tooth",       "fork-knife",       "cup",       "basket",       "dumbbell",       "phone",       "envelope",       "house",       "car",       "train",       "bed",       "book",       "clapperboard",       "watering-can",       "dog",       "pill",       "stethoscope",       "purse",       "gift",       "glass",       "suitcase",       "shoe",       "scissors",       "laptop",       "guitar",       "bicycle",       "sun",       "moon",       "heart",       "star",       "question",       "bus",       "coin",       "flower",       "ball",       "cat",       "camera",       "key",       "baby",       "pen"      ],      "description": "The small drawn mark Cotton Days shows beside it, only when the person gave one; most todos have none."     }    },    "required": [     "title"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "list_todos",   "title": "List todos",   "description": "Browse the user's todos directly — each with the projects it is filed under — including undated ones (an undated todo is filed, not scheduled). Defaults to every open todo; filter by status, a due window, one project's slug, or unfiled for the todos in no project. The list PAGES: when more is true the answer carries nextCursor, and passing it back as cursor with the same filters reads the next page — walk it to the end rather than reporting the first page as the whole list. Use search_records instead when you are looking for a todo by its words.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "status": {      "type": "string",      "enum": [       "open",       "done",       "dropped",       "missed",       "all"      ],      "description": "Which todos to list (default open). 'missed' is an earlier occurrence of a repeating todo left open when a later one was done."     },     "dueAfter": {      "type": "string",      "description": "Only todos due at or after this ISO 8601 timestamp."     },     "dueBefore": {      "type": "string",      "description": "Only todos due before this ISO 8601 timestamp."     },     "includeUndated": {      "type": "boolean",      "description": "Include todos with no due date (default true). A due window filters them out unless this is set explicitly."     },     "project": {      "type": "string",      "description": "Only todos filed under this project's slug; 'none' means the todos in no project."     },     "unfiled": {      "type": "boolean",      "description": "Only todos in no project — the same question as project 'none'. Not with a project slug."     },     "cursor": {      "type": "string",      "description": "nextCursor from the previous page, passed back unchanged with the same filters. Omit it for the first page."     },     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 5000     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "update_todo",   "title": "Update a todo",   "description": "Change an existing todo by id: retitle it, rewrite its notes, move its day, set or drop its time, clear its due, set or clear its high priority, snooze it, or set its status — 'dropped' cancels a todo without pretending it got done, 'open' reopens one. The due is a DAY plus an optional TIME: dueDate moves the day and keeps the hour, dueTime sets the hour and keeps the day, dueTime null keeps the day and drops the hour, dueDate null clears the due. Rescheduling is done here, never complete-and-recreate. Editing one occurrence of a repeating todo changes that occurrence only; `rrule` reshapes its series (or makes a plain todo repeat, anchored at its due), and `rrule: null` stops the series, keeping this todo as a plain one. Finishing an occurrence makes the series' next one. A repeating todo has one open occurrence at a time: one left undone stays that one, however late, and Cotton Days shows it on today; to skip it set status 'dropped', and its next is made. One todo a call. Find the id with list_todos or search_records first; never guess one.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The todo's uuid."     },     "title": {      "type": "string"     },     "notes": {      "type": [       "string",       "null"      ],      "description": "Replacement notes; null clears them."     },     "dueDate": {      "type": [       "string",       "null"      ],      "description": "The day, YYYY-MM-DD in the user's zone. Moves the day and keeps any hour; null clears the whole due (filed, not scheduled). Not with dueAt."     },     "dueTime": {      "type": [       "string",       "null"      ],      "description": "The clock time on the todo's day, HH:mm (24-hour) in the user's zone. Sets the hour and keeps the day; null KEEPS the day and drops the hour — a date-only todo. Not with dueAt."     },     "timezone": {      "type": "string",      "description": "IANA zone dueDate/dueTime are read in (e.g. Asia/Kolkata). Omit it and the user's own zone is used."     },     "dueAt": {      "type": [       "string",       "null"      ],      "description": "The exact due instant as ISO 8601, when you already hold it; null clears the due. Prefer dueDate/dueTime. Not with dueDate/dueTime."     },     "priority": {      "type": "string",      "enum": [       "high",       "none"      ],      "description": "Set or clear the todo's high-priority flag."     },     "snoozedUntil": {      "type": [       "string",       "null"      ],      "description": "Hide the todo until this ISO 8601 timestamp; null un-snoozes it."     },     "status": {      "type": "string",      "enum": [       "open",       "done",       "dropped"      ],      "description": "'open' reopens, 'done' completes it (and marks a repeating todo's earlier open occurrences missed), 'dropped' cancels without pretending it got done."     },     "rrule": {      "type": [       "string",       "null"      ],      "description": "iCal RRULE (FREQ=DAILY/WEEKLY/MONTHLY/YEARLY, with INTERVAL/COUNT/UNTIL/BYDAY): a plain todo starts repeating from its due; an occurrence's series takes the new rule. null stops the series and keeps this todo."     },     "mark": {      "type": [       "string",       "null"      ],      "enum": [       "cake",       "plane",       "tooth",       "fork-knife",       "cup",       "basket",       "dumbbell",       "phone",       "envelope",       "house",       "car",       "train",       "bed",       "book",       "clapperboard",       "watering-can",       "dog",       "pill",       "stethoscope",       "purse",       "gift",       "glass",       "suitcase",       "shoe",       "scissors",       "laptop",       "guitar",       "bicycle",       "sun",       "moon",       "heart",       "star",       "question",       "bus",       "coin",       "flower",       "ball",       "cat",       "camera",       "key",       "baby",       "pen",       null      ],      "description": "The small drawn mark Cotton Days shows beside it; null takes it off."     }    },    "required": [     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "update_definition",   "title": "Change a table's look, or put a tool, board or theme",   "description": "Change every present or future look key of a table as data, including built-ins (Devices, Todos). Table identity, engines, commands, connections and shipped column types stay fixed; the card is the build's on every table and the kit names it, so card writes are refused. Look keys include: `slip` (a row in its list), `tile` (its tile on a board), `page` (the sections of a record's page), `page_parts` (the page's parts in order: title, facts, grid, content, messages, script, sections, strip), `parts`, `picture` (the tool card's picture: an object name or {\"photo\": \"photo:<sha256>\"}), `group`, `sort` and `empty` (the list's sections, order and empty words), `links` and `menu` (the acts its list's menu offers: send the table's own entries in the order wanted, leaving out the ones to hide — an act the table does not offer is refused), `groups` (its stacks: the face a group's pile is drawn with, or null for none; where groups are kept stays the table's), `columns` on a shipped table (its whole list: every shipped key and type preserved — name, readonly, format, units, hidden and placeholder are look overlays; it is never removed or retyped, its engine reads it — then the person's own, keyed own_… with a name and a type of text, longtext, date, time, number, amount, choice (with choices), bool or url; their values are written with update_record like any column), `columns` on a made table (the whole existing list, with the same look overlays; adding, removing or retyping columns is refused), `live_read` (the read-only engine fields and bindings; methods outside the core allowlist are refused), and `instructions`. Each value replaces that key whole (null removes it, except a shipped tool's picture: null restores its shipped picture); a value put back to what Cotton ships follows Cotton's file again. Called with `table` alone it answers those keys as they stand and writes nothing — read them first and send back the whole edited value. A shipped column's type, engines, commands and connections are refused. The result is validated and refused whole if it does not draw; it answers `before`, each changed key as it stood. With `kind` tool, board or theme, it puts that definition WHOLE as data instead: `definition` is the whole JSON with its `id`, taking the place of the one with that id (or added beside them), the rest of that kind untouched; the database's definitions move on and every phone draws it on its next sync. A tool needs a name, and its automations each a when and a then; every view's card is the build's and the kit names it, so a tool sent back whole carries each view's card as the object holds it, and one that names, changes or drops a view's card is refused; a board's parts are a list. It answers `{ kind, id, changed, before, definition }` — `before` the definition it replaced, or null. With `kind` tool, board or theme and `remove` naming an id instead of `definition`, that definition is taken out whole: every phone stops drawing it on its next fetch; it answers `{ kind, id, removed, before }`. A tool the kit still ships is refused (it leaves the kit first); one the kit no longer ships stays removed.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The table's id (device, todo, or one a person defined)."     },     "columns": {      "type": "array"     },     "slip": {      "type": [       "object",       "null"      ]     },     "tile": {      "type": [       "object",       "null"      ]     },     "page": {      "type": [       "array",       "null"      ]     },     "page_parts": {      "type": [       "array",       "null"      ],      "items": {       "type": "string",       "enum": [        "title",        "facts",        "grid",        "content",        "messages",        "script",        "sections",        "strip"       ]      }     },     "parts": {      "type": [       "object",       "null"      ]     },     "picture": {      "type": [       "string",       "object",       "null"      ]     },     "group": {      "type": [       "object",       "null"      ]     },     "sort": {      "type": [       "object",       "null"      ]     },     "empty": {      "type": [       "object",       "null"      ]     },     "links": {      "type": [       "array",       "null"      ]     },     "menu": {      "type": [       "array",       "null"      ]     },     "groups": {      "type": [       "object",       "null"      ]     },     "live_read": {      "type": [       "object",       "null"      ]     },     "instructions": {      "type": [       "string",       "null"      ]     },     "kind": {      "type": "string",      "enum": [       "table",       "tool",       "board",       "theme"      ],      "description": "What is changed: a table's look (the default, with `table`), or a whole tool, board or theme (with `definition`)."     },     "definition": {      "type": "object",      "description": "With kind tool, board or theme: the whole definition, its `id` naming which it replaces."     },     "remove": {      "type": "string",      "description": "With kind tool, board or theme: the id of the definition to take out, in place of `definition`."     }    },    "additionalProperties": true   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "list_tools",   "title": "List tools",   "description": "List imported tool definitions with their author and signature: `signature` is \"unsigned\", or \"signed\" with `by`, the signing device key.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {},    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "list_records",   "title": "List a table's records",   "description": "Ahead reads monthly expected occurrences through from/to, by default as many calendar months from the reader day as the view's horizon says (three where its definition names none). Each later occurrence carries its stored row identity and month index; the read creates no rows. With last_changed true, answers only {table, last_changed}: the latest live record stamp for the whole table, or null where no stored stamp exists; ask without filters or paging. A built-in marked derived is answered by its engine. Supply today (YYYY-MM-DD) for a day-dependent view; missing or invalid days are refused. One page of any table's records, by the table's id — a built-in such as `todo`, `note` or `goal`, or a table the user defined. Each record is `{ table, id, data, created_at, updated_at, deleted_at, byline }`, `data` keyed by the table's column keys. Deleted records are left out. `project` (a project id or slug) keeps the records filed under it; `query` keeps those whose title or text columns contain every word. `where` keeps those whose columns hold what it names — an object of column keys, each mapped to a value (`{\\\"status\\\": \\\"open\\\"}`), a list of values or `{\\\"values\\\": [..]}` (any one of them), or `{\\\"present\\\": true}` / `{\\\"present\\\": false}`, or on a date column `{\\\"month\\\": 1-12}` (that month in any year) or `{\\\"within_days\\\": n}` (no more than n days back, or later); every entry must hold, and a column the table does not have or cannot be narrowed by is refused — `where: {\\\"thread_id\\\": id}` reads one chat's messages, `where: {\\\"from_email\\\": address}` one person's emails. `since` and `until` keep the records whose time falls in that window: the table's date where its definition names one, else when the record was made; a day is read in the reader's zone (`timezone`, else the workspace's), from its start for since and through its end for until. A table whose definition `shows` only some of its records lists just those (the accounts list: the places money sits) unless `where` names that column itself. Paging is by offset: `page` is how many records to skip (0 first), `limit` how many to return (50 by default, at most 5000), and the answer's `next_page` is the `page` to ask for next, or null when there are no more; `total` is how many records the whole list holds. A list read in sections — todos (today, late newest first, each of the next seven days, later, undated, done, dropped) and a list split into days such as the calendar (coming from today soonest first, earlier newest first) — also answers `sections`, `[{key, count}]` (a day ahead also `day`), each count over the whole list on the reader's day (`today`, else the day in `timezone`), sections with none left out; its records come today, the days ahead, the undated, the late, then the closed — or, with `section`, only that section's. `ids` (1 to 5000 record ids) answers just those records instead, live ones only, in the order asked — every other narrowing and paging argument is refused beside it. Archived records are left out of the list; `archived: true` answers only the table's archived records instead (never binned ones), in the same order, paged the same way, `total` how many are archived — `limit: 0` beside it answers that count with no records. A table whose records are never archived refuses it. An archived record comes back with update_record, clearing its archive column.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "view": {      "type": "string",      "description": "A tool view of this table, by its id (or tool/view): the list reads in that view's own order and slips where it declares them."     },     "count_only": {      "type": "boolean",      "description": "Read only the visible count. Takes table, today, timezone and an optional Money runway from/to window; answers total without records."     },     "last_changed": {      "type": "boolean",      "description": "Read only the whole table’s latest live change stamp, without record bodies."     },     "timezone": {      "type": "string",      "description": "The reader's IANA time zone (\"Europe/Lisbon\"). An event's day and start time are answered in it; absent, the workspace's zone."     },     "today": {      "type": "string",      "description": "The caller calendar day, YYYY-MM-DD. Money engine views default from a known workspace timezone; send this when the workspace has no known timezone."     },     "table": {      "type": "string",      "description": "The table's id, as its definition names it: \"todo\", \"note\", or a table the user defined such as \"lesson\"."     },     "project": {      "type": "string",      "description": "A project id or slug."     },     "query": {      "type": "string",      "description": "Words to look for in the title and text columns."     },     "where": {      "type": "object",      "description": "Column key → a value, a list of values (any one), {\"values\": [..]} or {\"present\": true|false}; every entry must hold. On a table with groups, {\"group\": id} alone answers that group's records in the group's own order."     },     "since": {      "type": "string",      "description": "Only records from this moment on, by the record's time (its table's date, else when it was made): a day (YYYY-MM-DD, from its start in the reader's zone) or an instant with its offset (2026-10-25T09:00:00Z)."     },     "until": {      "type": "string",      "description": "Only records up to this moment, by the record's time: a day (YYYY-MM-DD, through its end in the reader's zone) or an instant with its offset."     },     "page": {      "type": "integer",      "minimum": 0,      "description": "How many records to skip; next_page from the previous answer."     },     "limit": {      "type": "integer",      "minimum": 0,      "maximum": 5000,      "description": "How many records to return (default 50); 0 only beside archived: true."     },     "ids": {      "type": "array",      "items": {       "type": "string"      },      "minItems": 1,      "maxItems": 5000,      "description": "Record ids: answer just these records, in this order, instead of a page."     },     "section": {      "type": "string",      "description": "On a list read in sections (todos; a list split into days, such as the calendar): only this section's records, paged as usual, total its count. Todos: today, late, day (with day), later, undated, done, dropped. Calendar: coming, earlier."     },     "day": {      "type": "string",      "description": "With section \"day\": which of the next seven days, YYYY-MM-DD."     },     "period": {      "type": "string",      "enum": [       "this_month",       "today",       "tomorrow",       "next_7_days",       "next_day",       "this_year"      ],      "description": "Only records whose own date falls in this stretch from today (say today): this_month, today, tomorrow, today and the six days after it, next_day — the first day after today that holds any of the list's records — or this_year, the calendar year of today. Tables the user or a package defined only."     },     "archived": {      "type": "boolean",      "description": "true: only the table's archived records (never binned ones), total how many are archived; with limit 0, that count alone."     },     "from": {      "type": "string",      "format": "date",      "description": "For a monthly Money runway view, the first calendar day of its window, YYYY-MM-DD; defaults to the reader day."     },     "to": {      "type": "string",      "format": "date",      "description": "For a monthly Money runway view, the last calendar day of its window, inclusive, YYYY-MM-DD; defaults to the view's horizon in calendar months from the first day (three where its definition names none), exclusive."     }    },    "required": [     "table"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "search_records",   "title": "Search the records",   "description": "Find the records that mention a name, a company or a word — the messages, emails, people and notes about it — to read as context. Not for bulk export: it answers hits, never whole records, at most 200. `q` is matched as written, letters in any case, inside the title and text columns of `table`, of each of `tables`, or of every table the record tools read when neither is given; a stored secret's value, a token and any sealed or hashed column are never searched. Hits come newest first by the record's time — its table's date (a message's or an email's sent_at) where the definition names one, else when the record was made — each `{ table, id, column, excerpt, at }`: the column the words were found in, a few words either side of them, and the record's time; `title` beside it is the record's title where it was found in another column, and `archived: true` marks an archived record. Binned records are left out. `since` and `until` keep the hits in that window of time. `more: true` says there were more hits than `limit` — narrow by table or window rather than raising it. Read a hit whole with get_record_by_table, and its neighbours with list_records `where` (a message's `thread_id`, an email's `thread_id` or `from_email`).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "q": {      "type": "string",      "minLength": 2,      "description": "The words to find, as written: a person's name, a company, a phrase. Letters in any case."     },     "table": {      "type": "string",      "description": "Search only this table, by its id: \"message\", \"email\", \"person\", \"note\"."     },     "tables": {      "type": "array",      "items": {       "type": "string"      },      "minItems": 1,      "maxItems": 50,      "description": "Search only these tables, by id. Say table or tables, not both; neither searches every table."     },     "since": {      "type": "string",      "description": "Only records from this moment on, by the record's time (its table's date, else when it was made): a day (YYYY-MM-DD, from its start in the reader's zone) or an instant with its offset (2026-10-25T09:00:00Z)."     },     "until": {      "type": "string",      "description": "Only records up to this moment, by the record's time: a day (YYYY-MM-DD, through its end in the reader's zone) or an instant with its offset."     },     "timezone": {      "type": "string",      "description": "The reader's IANA time zone (\"Asia/Kolkata\"), for a since or until said as a day; absent, the workspace's zone."     },     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 200,      "description": "How many hits to return (default 25, at most 200)."     }    },    "required": [     "q"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "get_record_by_table",   "title": "Get one record of a table",   "description": "One record of any table, by the table's id and the record's id, in the bin or not: `{ table, id, data, created_at, updated_at, deleted_at, byline }`, `deleted_at` the moment it was binned. `data` is keyed by the table's column keys; a column with no value is left out, and so is a sealed or hashed one. A record erased for good is no longer here. The file a record keeps comes with get_media.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "timezone": {      "type": "string",      "description": "The reader's IANA time zone (\"Europe/Lisbon\"). An event's day and start time are answered in it; absent, the workspace's zone."     },     "today": {      "type": "string",      "description": "The caller calendar day, YYYY-MM-DD. Money engine views default from a known workspace timezone; send this when the workspace has no known timezone."     },     "table": {      "type": "string",      "description": "The table's id, as its definition names it: \"todo\", \"note\", or a table the user defined such as \"lesson\"."     },     "id": {      "type": "string",      "description": "The record's id."     }    },    "required": [     "table",     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "create_record",   "title": "Create a record in a table",   "description": "Add one record to any table, by the table's id. `data` is an object of column keys and values, checked against the table's definition: a key the table does not have, a missing required column or a value of the wrong type is refused with the reason. Values are JSON by column type: text and longtext a string; date \\\"YYYY-MM-DD\\\"; time \\\"HH:MM\\\"; number a number; amount a WHOLE number of currency minor units — 12.5 or even 12.0 is refused, never rounded; choice one of the column's choices; link the linked record's id; photo and file a media key; bool true or false; url an absolute web address starting http:// or https://. null clears a column. A column the data leaves out takes the definition's `default` for it when there is one. A link must name a record that exists. A named list of any table whose definition has `groups` (events, films, books, todos and the rest) is a `record_group` row { table_id, name }, and each record in it a `group_member` row { group, record_id, place }. For a built-in table the record is written by that table's own tool, so its rules still hold; a built-in that cannot be written this way says so. Every write answers `{ change, record, change_id, undoable }`: `change` says who wrote it (`byline`), the columns that changed `before` and `after`, and a `receipt` in words; `change_id` (the change's `id`) takes it back with undo.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The table's id, as its definition names it: \"todo\", \"note\", or a table the user defined such as \"lesson\"."     },     "data": {      "type": "object",      "description": "The new record's values, keyed by column key."     }    },    "required": [     "table",     "data"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "update_record",   "title": "Update a record in a table",   "description": "Change some values of one record, by the table's id and the record's id. `patch` names only the columns to change; a key left out is kept and null clears it (never a required column). Values are JSON by column type: text and longtext a string; date \\\"YYYY-MM-DD\\\"; time \\\"HH:MM\\\"; number a number; amount a WHOLE number of currency minor units — 12.5 or even 12.0 is refused, never rounded; choice one of the column's choices; link the linked record's id; photo and file a media key; bool true or false; url an absolute web address starting http:// or https://. null clears a column. Every write answers `{ change, record, change_id, undoable }`: `change` says who wrote it (`byline`), the columns that changed `before` and `after`, and a `receipt` in words; `change_id` (the change's `id`) takes it back with undo. `before` and `after` hold only the columns that changed.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The table's id, as its definition names it: \"todo\", \"note\", or a table the user defined such as \"lesson\"."     },     "id": {      "type": "string",      "description": "The record's id."     },     "patch": {      "type": "object",      "description": "The columns to change, keyed by column key; null clears one."     },     "scope": {      "type": "string",      "enum": [       "this",       "all"      ],      "description": "A repeating event only, and then required: \"this\" changes the day the id names (a later day's id is <series>@<start>) as its own event and leaves the series; \"all\" changes every day of it."     }    },    "required": [     "table",     "id",     "patch"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "delete_record",   "title": "Delete a record from a table",   "description": "Delete one record, by the table's id and the record's id. A record of a table with a bin (a `trashed_at` or `deleted_at` column) is binned: that column takes the moment, the record leaves every list, and restore_from_bin brings it back until empty_bin erases it. A record of a table with no bin is erased at once: undo with the answer's `change_id` brings it back, holding what it held, for as long as the change log keeps the change (90 days) — still say what you are about to erase and let the user answer first. A table whose records are never deleted directly says so. Every write answers `{ change, record, change_id, undoable }`: `change` says who wrote it (`byline`), the columns that changed `before` and `after`, and a `receipt` in words; `change_id` (the change's `id`) takes it back with undo.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The table's id, as its definition names it: \"todo\", \"note\", or a table the user defined such as \"lesson\"."     },     "id": {      "type": "string",      "description": "The record's id."     },     "scope": {      "type": "string",      "enum": [       "this",       "all"      ],      "description": "A repeating event only, and then required: \"this\" deletes the day the id names (a later day's id is <series>@<start>) into the bin and leaves the series; \"all\" deletes every day of it."     }    },    "required": [     "table",     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "brief",   "title": "The memory briefing",   "description": "The owner's standing knowledge for this session, compiled from their memory: the matched project's entries in the owner's own order — the procedures linked to it (one line each: the name, the trigger to match a task against, and the note id to read it by), the last five sessions across all their machines, and what needs their attention. Memory belongs to projects: there is no project-independent layer, so call it at the START of working with the git remote you are working in (repoUrl) or the project slug (project), plus your hostname (machine). A repo bound to no project gets a two-line answer saying how to find one (list_projects, then brief { project }). Entries are addressed by [slug]: cite them, never restate them. Every entry is the owner's own words — technical facts about the code live in the repo, not here. Compiled and budgeted — over budget it sheds procedure lines first, then recent sessions, and only then whole entries from the end of the owner's order — never part of one — with a line saying how many were left out; `recall` is the full set. A session that spans several projects names them in `projects`, briefed in the order given.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "repoUrl": {      "type": "string",      "description": "The git remote of the repository this session works in, any spelling (https, ssh, scp). Resolves which projects brief."     },     "project": {      "type": "string",      "description": "A project slug from list_projects, when you know it — overrides repoUrl resolution."     },     "projects": {      "type": "array",      "items": {       "type": "string"      },      "minItems": 1,      "maxItems": 4,      "description": "Several project slugs from list_projects, briefed in this order — overrides repoUrl resolution. Send this or project, not both."     },     "machine": {      "type": "string",      "description": "This machine's hostname. Machine-scoped memories brief only on their machine."     },     "budgetTokens": {      "type": "integer",      "minimum": 400,      "maximum": 6000,      "description": "Token budget for the briefing (default 4000). Over it, whole entries are left out from the end of the owner's order and a line counts them."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "recall",   "title": "Recall memory entries",   "description": "The owner's memory beyond the briefing — the owner's own words, nothing else. `q` is a ranked full-text search — reach for it BEFORE assuming you do not know what the owner thinks (the ruling behind a habit, a standing preference, the current state of their work). With `project`, that project's entries in ITS order — pinned first, then the owner's arrangement; without, every entry newest-first, each carrying `projects: [{ slug, pinned, position }]` — the projects it briefs in and how it is arranged in each. Technical facts are not here: they live in the repo, next to the code that can invalidate them. Default: active entries.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "q": {      "type": "string",      "description": "Search terms — full-text, ranked. A query with no searchable words falls back to a substring match."     },     "project": {      "type": "string",      "description": "A project slug from list_projects — that project's entries in its own order. Omit for every entry, newest-first."     },     "status": {      "type": "string",      "enum": [       "active",       "archived",       "all"      ],      "description": "Default active."     },     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 300,      "description": "Maximum entries to return (default 100)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "remember",   "title": "Remember a fact",   "description": "Transcribe one thing the OWNER SAID into their memory — RECONCILED against what is already there, so duplicates never reach the feed. Memory is the owner's mind: every entry is the owner's own words, quoted or faithfully condensed; nothing you inferred on your own goes in, and technical facts about code never do (they live in the repo — an AGENTS.md partial, the app's CLAUDE.md, a runbook, a skill, a guard). The SENTENCE is the memory: one imperative, factual line (≤280 chars); a longer thought is several thoughts — split it into separate calls. Memory has no categories: what the entry is, is the sentence. Every write lands live. An entry that is only true for a while SAYS SO IN ITS OWN SENTENCE — \"… — valid until 24 Oct\", \"… until the app launches\" — and when you read one whose date has passed you archive it with memory_archive; there is no dated flag and nothing comes back on a schedule. A memory belongs to projects, so project is REQUIRED: the entry briefs in that project, in its order — except an Owner entry, what is true of the owner whatever the project, written with no project in their personal database and briefed first in every brief (300 tokens, refused past that); the same sentence can later be linked into other projects with link_to_project (kind memory) — never written twice. Pin it when the owner wants every assistant working in that project to read it first. Give source when you have one (a PR or commit URL, session:<tool>:<id>, file:<path>, note:<id> for long source material you filed as a note). The reconcile loop: when similar entries exist the call answers { needsDecision, candidates } and writes NOTHING — read them and call again with decision: { action: \"update\", target: <slug> } to correct one, { action: \"supersede\", target } when the new fact replaces it, or { action: \"add\" } when it is genuinely different. An entry that already says the same thing answers { action: \"noop\" } — or, when it lives in other projects but not this one, { action: \"linked\" }: the existing entry gains this project and nothing else is written. Never store credentials; store a pointer to where they live.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "title": {      "type": "string",      "description": "The entry — one imperative, factual sentence in the owner's words, ≤280 chars."     },     "project": {      "type": "string",      "description": "The project slug, from list_projects — where the entry briefs. Required, except for an Owner entry. A fact that holds in several projects is remembered once and linked into the others with link_to_project."     },     "owner": {      "type": "boolean",      "description": "An Owner entry: what is true of the owner whatever the project — it opens every brief. Written with no project, in the owner's personal database (database: their personal database); owner: true says so explicitly."     },     "source": {      "type": "string",      "description": "Provenance: a URL, session:<tool>:<id>, file:<path>, note:<id>, or human."     },     "pinned": {      "type": "boolean",      "description": "Pin it in this project: a pinned entry briefs first in that project's list."     },     "machine": {      "type": "string",      "description": "Hostname, when what the owner said holds on one machine only."     },     "slug": {      "type": "string",      "description": "Bring a stable slug (kebab, ≤64) when you have one; otherwise it is minted from the title."     },     "decision": {      "type": "object",      "description": "Your answer to a needsDecision reply.",      "properties": {       "action": {        "type": "string",        "enum": [         "add",         "update",         "supersede",         "noop"        ]       },       "target": {        "type": "string",        "description": "The candidate's slug, for update and supersede."       }      },      "required": [       "action"      ],      "additionalProperties": false     }    },    "required": [     "title"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "log_session",   "title": "Log this session",   "description": "Record what this session did, so the next session on any machine learns it from the briefing instead of from a transcript. Idempotent: the same (tool, externalId) updates the one row. On a Mac with the hooks installed the row already exists — the SessionStart hook registers it with the tool's own title and model, and the Stop hook logs every turn of the conversation (the owner's prompts AND the assistant's replies, each with its role) — so a session calls this to add what only it knows: a summary (the latest wins) or a title. Use the externalId and machine the hooks use (the id is the tool's own session id, the one the SessionStart hook registered; machine is the hostname, `hostname -s`); a hand-picked id or a guessed machine name creates a second, phantom session on a machine that does not exist. A run with no machine of its own (a claude.ai cloud session) passes machine \"cloud\". Summary and prompts are redacted before they are written; PR and commit links in the summary are kept as shipped. The transcript itself is never sent — transcriptRef is a pointer. Send `tasks` to mirror your own task list onto the session row, so the owner can see \"4/6\" on the card and open the list: the array REPLACES whatever the row held, so send the whole list every time and send an empty array when there is nothing left.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "tool": {      "type": "string",      "enum": [       "claude-code",       "codex",       "kimi",       "gemini",       "opencode",       "other"      ]     },     "externalId": {      "type": "string",      "description": "The tool's own session id — the one the SessionStart hook named, never the claude.ai session URL id."     },     "sessionId": {      "type": "string",      "description": "The Cotton row this session IS, when something told you which one — on a Mac the helper puts it in the agent's environment as COTTON_SESSION_ROW_ID and the hooks pass it here, so a session Cotton started stays one row from its first hook. Always the FULL row id, never a prefix: an id this database does not hold fails the call, and a row already logging another session is left alone."     },     "machine": {      "type": "string",      "description": "This machine's hostname (`hostname -s`), exactly as the hooks report it; \"cloud\" for a run with no machine. Never a guess."     },     "repoUrl": {      "type": "string",      "description": "The git remote, any spelling — resolves the project."     },     "branch": {      "type": "string"     },     "cwd": {      "type": "string"     },     "project": {      "type": "string",      "description": "A project slug, when you know it — overrides repoUrl resolution."     },     "startedAt": {      "type": "string",      "description": "ISO-8601; defaults to lastActiveAt on first sight."     },     "lastActiveAt": {      "type": "string",      "description": "ISO-8601 — now."     },     "endedAt": {      "type": "string",      "description": "ISO-8601, when the session is over."     },     "title": {      "type": "string",      "description": "The tool's session title (≤140)."     },     "titleIfEmpty": {      "type": "string",      "description": "The first line of the first prompt (≤140) — written only when this session has no title yet. Pass `title` instead to rename one deliberately."     },     "summary": {      "type": "string",      "description": "The last assistant recap (≤2000); the latest wins."     },     "model": {      "type": "string",      "description": "The model id the tool reports (claude-fable-5-1), ≤80; the latest wins."     },     "turnCount": {      "type": "integer",      "minimum": 0,      "description": "Set explicitly; otherwise each call counts one turn."     },     "prompts": {      "type": "array",      "description": "The turns since the last call — what the owner typed and what the assistant said back, in order. The parameter keeps its historical name; a turn without a role is the owner's.",      "items": {       "type": "object",       "properties": {        "seq": {         "type": "integer",         "minimum": 0,         "description": "Position in the session — any non-negative integer, unique per session across both roles."        },        "ts": {         "type": "string",         "description": "ISO-8601."        },        "role": {         "type": "string",         "enum": [          "user",          "assistant"         ],         "description": "Who said it; defaults to user."        },        "text": {         "type": "string",         "description": "≤8000; redacted on arrival."        }       },       "required": [        "seq",        "ts",        "text"       ],       "additionalProperties": false      }     },     "transcriptRef": {      "type": "string",      "description": "box:<machine>:<path> — a pointer, never content."     },     "tasks": {      "type": "array",      "description": "Your own task list, mirrored onto the session row. The whole list every time: what you send REPLACES what the row held, and an empty array clears it. Omit the parameter entirely to say nothing about tasks.",      "items": {       "type": "object",       "properties": {        "seq": {         "type": "integer",         "minimum": 0,         "description": "Position in the list, from 0 — unique per session."        },        "text": {         "type": "string",         "description": "The task, in your own words (≤500; truncated, never refused)."        },        "state": {         "type": "string",         "enum": [          "open",          "active",          "done"         ],         "description": "Defaults to open."        }       },       "required": [        "seq",        "text"       ],       "additionalProperties": false      }     }    },    "required": [     "tool",     "externalId",     "machine",     "lastActiveAt"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "list_sessions",   "title": "List sessions",   "description": "Recent sessions across every machine and tool, newest first — what happened elsewhere, without syncing chats. A session that has not started yet is here too, at `state: \"queued\"`: `prompt` is what it will open with, `requestedDeviceId` is the Mac the owner asked for (null means any Mac) and `holdReason` is the sentence saying why it is still waiting — no Mac signed in, every Mac full, or the chosen one not picking it up. Filter by project or machine, or narrow to a window with `since`; `q` searches what the owner typed (full-text over prompts) and returns the sessions that hit, with the matching snippets. `hostOwned` says whether Cotton holds the session's terminal or merely adopted it from the agent's own transcript. Every row says what KIND of session it is: a `conversation` is a project's one standing conversation and a `thread` is everything else, with `parentSessionId` naming the conversation that opened it. Pass `parent` to list one conversation's threads, or `kind` to list only one or the other. `tasksDone` and `tasksTotal` are the task list the session mirrored onto its own row — 0 and 0 for a session that mirrored none; get_session has the list itself. A full page carries `nextCursor`: pass it back as `cursor` with the same filters to read the next one.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 5000,      "description": "Default 20."     },     "project": {      "type": "string",      "description": "A project slug, or \"none\" for sessions assigned to no project."     },     "machine": {      "type": "string"     },     "q": {      "type": "string",      "description": "Search the prompts."     },     "since": {      "type": "string",      "description": "ISO-8601. Only sessions that did something at or after this instant (their last activity, whether or not they have ended). Use it for \"what has been running this week\" rather than raising the limit."     },     "parent": {      "type": "string",      "description": "A conversation's session id — only the threads it opened. This is how a project conversation reads its own work."     },     "kind": {      "type": "string",      "enum": [       "conversation",       "thread"      ],      "description": "Only the project conversations, or only the threads."     },     "cursor": {      "type": "string",      "description": "nextCursor from the previous page, passed back unchanged with the same filters. Omit it for the first page."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "get_session",   "title": "Read one session",   "description": "One session, whole: what it is doing (`state`), what it is waiting on, what it last said, the prompt it opened with, its recap, the Mac it is on, and the sentence on `holdReason` or `error` if something stopped it. `prompts` is its last twenty turns, oldest first — the owner's and the assistant's, each with its role — and `tasks` is the task list it mirrored onto its row, in its own order, with `tasksDone` and `tasksTotal` beside it. `kind` says whether this is a project's standing conversation or a thread, and `parentSessionId` names the conversation that opened it. Read this before reporting on a thread; it is the summary, not the transcript, and the transcript stays on the Mac that made it.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "sessionId": {      "type": "string",      "description": "The session's id, as list_sessions answers with."     }    },    "required": [     "sessionId"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "list_devices",   "title": "List the devices",   "description": "Every phone and Mac approved to open this database, newest approval first: its name, what it is, the version it is running right now, when it joined and which device approved it, and — for one that has been cut off — when and why. The version is kept current: a device says what it is on every request it makes, and its row is rewritten on the day that changes. A revoked device stays in the answer and says so; re-admitting a key is a new approval, never an undo. A Mac also says what it can do for a release — `capabilities`: `builder` when it is declared to run the signing jobs, `signer` when its keychain holds the Developer ID identity — beside its free disk, load and memory as of `sampledAt`; any number of Macs may be both, so read every row rather than looking for one build Mac. This is a READ. Nothing over MCP approves, renames or revokes a device: joining is a person comparing six digits on two screens, and revoking is a confirmed red row in the owner's own app.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "includeRevoked": {      "type": "boolean",      "description": "Default true. False lists only the devices that may open the database right now."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "list_projects",   "title": "List projects",   "description": "The workspace's projects: slug, name, description, the git remotes that resolve to each, status, the brand kit where one is set, and a count of what is linked to each (chats, people, notes, todos, meetings, documents, …). A project is the owner's working context for one piece of work — read this to learn the vocabulary before brief { project }, link_to_project or remember. Active rows that share one slug each carry their `id` and `sharedSlug` { rows, resolvesTo }: the slug means the row holding more memory links.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {},    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "create_project",   "title": "Create a project",   "description": "Start a new project: the working context memory entries are briefed by. Give it a name; the slug is made from the name (lower case, hyphens) unless you send one, and a slug an active project already holds is refused. `repos` binds the git remotes whose sessions brief it. The owner's alone. list_projects first: do not create one per conversation.",   "scope": "owner",   "inputSchema": {    "type": "object",    "properties": {     "name": {      "type": "string",      "description": "The display name."     },     "slug": {      "type": "string",      "description": "1-64 chars of a-z, 0-9 and dashes, starting alphanumeric. Absent, it is made from the name."     },     "repos": {      "type": "array",      "items": {       "type": "string"      },      "description": "Git remotes whose sessions should brief this project."     }    },    "required": [     "name"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "update_project",   "title": "Update a project",   "description": "Rename a project, replace the git remotes it briefs for, or archive it or bring it back (status). Send only what changes. Address it by slug, or by id where several rows share the slug (list_projects names them). Links and memory entries stay where they are. The owner's alone.",   "scope": "owner",   "inputSchema": {    "type": "object",    "properties": {     "project": {      "type": "string",      "description": "The project's slug from list_projects, or its id where rows share a slug."     },     "name": {      "type": "string",      "description": "A new display name."     },     "repos": {      "type": "array",      "items": {       "type": "string"      },      "description": "Replace the whole list with these remotes. An empty array unbinds every repo."     },     "status": {      "type": "string",      "enum": [       "active",       "archived"      ],      "description": "archived takes the project out of every brief; active brings it back."     }    },    "required": [     "project"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "link_to_project",   "title": "Link records to a project",   "description": "File records under a project — a chat thread, person, note, journal entry, todo, event, meeting, document, page, location, transaction, goal, or a photo album — so the project gathers them (list_projects counts them). One record can belong to several projects (the owner's chat with a collaborator genuinely spans the projects they work on together); linking again is safe. The optional note per record says what standing the record has in THIS project (\"the main group chat\", \"superseded by the v2 contract — kept for reference\"): omit note to leave an existing note alone, send a string to set or replace it, and send null to clear it. Individual messages are never linked: link the thread, context does the rest. A memory entry links here too (kind memory, the entry's id from recall): it joins the tail of the project's list and briefs there from then on; linking an ARCHIVED entry restores it — a home is what brings a dropped entry back. `pinned` on a memory record pins it in that project (memory only; a new link is unpinned).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "project": {      "type": "string",      "description": "The project's slug, from list_projects."     },     "records": {      "type": "array",      "minItems": 1,      "maxItems": 50,      "items": {       "type": "object",       "properties": {        "kind": {         "type": "string",         "enum": [          "thread",          "email_thread",          "person",          "note",          "journal",          "todo",          "event",          "meeting",          "document",          "page",          "location",          "transaction",          "goal",          "feedback",          "thought",          "photo",          "video",          "memory",          "call",          "album"         ]        },        "id": {         "type": "string",         "description": "The record's id."        },        "note": {         "type": [          "string",          "null"         ],         "maxLength": 500,         "description": "What this record is to this project — shown wherever the link shows. Omit it to leave an existing note alone; pass null to clear one. On a document, the exact notes logo, logo-dark, wordmark and icon also fill that slot of the project's brand kit."        },        "pinned": {         "type": "boolean",         "description": "MEMORY ONLY: pin the entry in this project — a pinned entry briefs first in that project's list. Omit it to leave an existing pin alone; a new link is unpinned. Any other kind naming it is refused."        }       },       "required": [        "kind",        "id"       ],       "additionalProperties": false      }     }    },    "required": [     "project",     "records"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "memory_update",   "title": "Update a memory entry",   "description": "Correct or evolve one entry, addressed by slug or id. Send only the fields that change: the sentence (title), its source, its machine scope. An expiry belongs IN the sentence (\"… — valid until 24 Oct\"), never in a flag beside it. Every prior state is version-snapshotted with restore behind it. `pinned` is PER PROJECT: pass project with it to pin or unpin the entry in that project's list (the sentence is untouched). Re-homing an entry is link_to_project, like any record.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "slug": {      "type": "string"     },     "id": {      "type": "string",      "description": "The entry's uuid, instead of slug."     },     "project": {      "type": "string",      "description": "With pinned: the project whose list the pin applies to."     },     "title": {      "type": "string"     },     "source": {      "type": "string",      "description": "Provenance: a URL, session:<tool>:<id>, file:<path>, note:<id>, or human."     },     "machine": {      "type": [       "string",       "null"      ],      "description": "New hostname scope, or null to brief everywhere."     },     "pinned": {      "type": "boolean",      "description": "Pin or unpin the entry in `project`'s list — pinned entries brief first there."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "memory_archive",   "title": "Archive a memory entry",   "description": "Retire an entry that no longer holds (work shipped, a ruling was superseded, the owner changed their mind) — everywhere, in one call. Archived entries leave every briefing but keep their history and project links. A `reason` is not kept on the entry: tell the owner why it went.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "slug": {      "type": "string"     },     "id": {      "type": "string"     },     "reason": {      "type": "string",      "description": "Why it no longer holds."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "create_secret",   "title": "Store a password or key",   "description": "Save a password, an API key, a secure note, a card or an identity document in the user's own database, sealed under a key only their own devices hold. Say which kind it is; pass the secret itself as value (a password, a key, a note's text) or as fields for the typed kinds. Re-saving the same name for the same service REPLACES the value — two live keys under one name is a question nothing here can answer — while a login, which has no service, is always a new one. The value passes through Cotton's server once, in the clear, while this one call is answered, and is then sealed so that only the user's own devices open it. You will never be able to read it back: no tool returns a stored value, and list_secrets answers only names. Cotton's own assistant runs on the key stored under service 'anthropic'.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "kind": {      "type": "string",      "enum": [       "login",       "api_key",       "note",       "card",       "identity",       "document"      ],      "description": "What this is. Defaults to api_key, which is the only kind that requires a service."     },     "name": {      "type": "string",      "description": "What the user calls it. At most 120 characters."     },     "site": {      "type": "string",      "description": "The host or address a login is for."     },     "username": {      "type": "string",      "description": "The username or address it signs in as."     },     "service": {      "type": "string",      "description": "Who the credential is for, lowercase and hyphenated — 'anthropic', 'openai', 'my-bank'. Required for an api key, which is how it is found again; omitted for a login. Cotton's assistant reads 'anthropic'."     },     "expiresAt": {      "type": "string",      "description": "When it runs out, as a date."     },     "value": {      "type": "string",      "description": "The secret itself — the password, the key, the note's text. Sealed before it is written and never returned by any tool, including this one. Pass this OR fields, never both."     },     "fields": {      "type": "object",      "description": "The typed payload for a kind with more than one field: a login is {password, notes, totp}, a card {number, holder, expiry, cvv, notes}, an identity {number, id_type, holder, issued, expires, country, notes}. Pass this OR value, never both."     }    },    "required": [     "name"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "list_secrets",   "title": "List stored keys",   "description": "The passwords, keys, notes, cards and identity documents the user has stored — the name, the site, the username and the service each is for, never the value or any part of it. Use it to tell the user what they already have, or to check whether the key a feature needs is set before telling them to paste one. What is in the bin is not here; list_bin answers that.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "kind": {      "type": "string",      "enum": [       "login",       "api_key",       "note",       "card",       "identity",       "document"      ],      "description": "Only this kind."     },     "service": {      "type": "string",      "description": "Only the secrets stored for this service."     },     "q": {      "type": "string",      "description": "Only the ones whose name, site, username or service carries this word. The sealed payload is never searched."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "dev_reveal_secret",   "title": "Developer: read one stored password back",   "description": "DEVELOPER TOOL — off in the public build. Open one of the owner's stored passwords, API keys or secure notes and answer what is inside it. This is the one reader of a stored value anywhere in the tool surface: the ordinary four verbs name a secret, store one, change one and bin one, and none of them can read one back — that stays true, and this tool is off in the public build precisely so it keeps being true there. The answer carries every field of the secret, so treat it as the credential it is: use it, do not repeat it back to the person in full, and remember the transcript is kept. The audit trail records WHICH secret was opened and never what it said. Find the id with list_secrets. Refused by name on a build that cannot open the vault.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "secretId": {      "type": "string",      "description": "The secret's uuid, from list_secrets."     }    },    "required": [     "secretId"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "run_act",   "title": "Run an act",   "description": "Run one of the database's acts — what its own app does through `/v1/act` — with the act's arguments in `args`. It runs as this token: an owner token as the owner; a write token as staff, which runs a table's own acts (booking, cancelling, an act a definition declares) and writes only where staff may, never roles, tokens or definitions. A definition act answers the definition as the object holds it, or the removal; a stale base answers the object's definition with conflict true. The answer is the act's own, unchanged: `{ version, changed, made?, notices, token? }` — `changed` every record it wrote as it now stands, `made` the record it made, `token` a minted token, said once. A refusal is the act's own sentence, its code in the structured content. `database` runs it in another of the owner's databases. Book and cancel here, never with create_record or update_record: a claim table a reservation owns refuses a direct write. The acts:",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "act": {      "type": "string",      "description": "The act's name, from the list above."     },     "args": {      "type": "object",      "description": "The act's arguments, as the list above names them: `?` marks one that may be left out."     },     "database": {      "type": "string",      "description": "Run the act in another of the owner's databases, by its id or name; absent, this one."     }    },    "required": [     "act"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "request_unlock",   "title": "Ask to read sealed tables",   "description": "Ask the owner to let this assistant read sealed tables (messages, notes, people and the like) for a while. A sealed table's private columns are kept as ciphertext the database cannot open; the owner allows a window on their phone, choosing how long (15 minutes, 1 hour, 1 day, or until they turn it off) and which of the tables asked, and only then do list_records, get_record_by_table, search_records and list_changes open its rows, and create_record and update_record seal what you write, for this assistant's connection (it stands across a token refresh), until the window ends. Every read and write in a window is listed for the owner (which assistant, which tables, when, how many rows). A read of a sealed table with no window is refused (structured code window_needed) and asks the same way; its `card` says which case it is: `account`, the one card \"Let your Claude read your data\" that lets your Claude read standing, filed as you connected and standing until the owner answers it (tell the owner to allow it; nothing is asked again); `each_time`, a table the owner keeps asked each time; `window`, a timed window where no standing grant answers. Answers `{ state: \"waiting\", card, request_id, tables, minutes, expires_at, sentence }` (tell the owner the sentence, then ask again once they allowed it; a timed request expires after 10 minutes, the account card stands until answered), `{ state: \"open\", tables, ends_at }` (or `standing: true` in place of ends_at, until the owner turns it off) when a window is open already, or `{ state: \"declined\", request_id, tables, expires_at, sentence }` when the owner chose Not now on this connection's request for any of these tables: nothing is asked until that request's expires_at, and a read of those tables meanwhile is refused the same way, as declined. `tables` defaults to every sealed table; `reason` is the one sentence the owner reads on the card; `minutes` only suggests (15, 60, 1440, or 0 for until turned off; default 15). Any assistant may ask; only the owner's own phone allows.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "tables": {      "type": "array",      "items": {       "type": "string"      },      "description": "The sealed tables to read, by id; absent, every sealed table."     },     "reason": {      "type": "string",      "description": "One sentence the owner reads on their phone: what you will read and why."     },     "minutes": {      "type": "integer",      "enum": [       15,       60,       1440,       0      ],      "description": "How long you suggest: 15 (the default), 60, 1440, or 0 for until the owner turns it off. The owner picks on the phone; their pick wins."     }    },    "required": [     "reason"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "end_unlock",   "title": "End the unlock window",   "description": "End this assistant connection's unlock windows now, a standing one too: the database drops the keys it held, and sealed tables read as sealed again. Answers `{ ended }`, how many windows ended.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {},    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "agent_chats",   "title": "The chats you are in",   "description": "The Comms chats the owner added you to as their agent, the newest first: `{ chats: [{ thread, title, members: [name], since }] }`. `thread` is what agent_chat_read, agent_chat_post and agent_chat_react take. You are an agent in these chats, never the owner: everything you post is marked as yours on every member's phone. Only chats the owner added you to answer; any other chat is refused. No unlock window is needed: what you read was sealed to this connection alone.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {},    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "agent_chat_read",   "title": "Read a chat you are in",   "description": "What was said in one chat you are in, oldest first, from the moment you joined: `{ messages: [{ id, at, from, name, mine, agent, body, reply_to?, pictures }], mark }`. `mine` is the owner's own words; `agent` names an agent's words (`self: true` your own). Pass the answer's `mark` back as `after` to read only what came since; without it, the last 50. You are an agent in these chats, never the owner: everything you post is marked as yours on every member's phone. Only chats the owner added you to answer; any other chat is refused. No unlock window is needed: what you read was sealed to this connection alone.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "thread": {      "type": "string",      "description": "The chat, as agent_chats names it."     },     "after": {      "type": "integer",      "minimum": 0,      "description": "The mark a previous read answered: only what came after it."     },     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 200,      "description": "How many messages at most (default 50)."     }    },    "required": [     "thread"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "agent_chat_post",   "title": "Post in a chat you are in",   "description": "Post words in one chat you are in, as the owner's agent: every member sees them marked as yours, with your name. `reply_to` (a message id from agent_chat_read) quotes that message. The owner's phone seals and sends it, so it waits until one of their phones is reachable: answers `{ id, state: \"waiting\" }`; agent_chat_state says when it went. Words only, 16 KB at most. You are an agent in these chats, never the owner: everything you post is marked as yours on every member's phone. Only chats the owner added you to answer; any other chat is refused. No unlock window is needed: what you read was sealed to this connection alone.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "thread": {      "type": "string",      "description": "The chat, as agent_chats names it."     },     "body": {      "type": "string",      "description": "What you say."     },     "reply_to": {      "type": "string",      "description": "A message id from agent_chat_read, to quote it."     }    },    "required": [     "thread",     "body"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "agent_chat_react",   "title": "React in a chat you are in",   "description": "React to one message in a chat you are in with one emoji, as the owner's agent (a reaction of yours replaces your earlier one on that message). Answers `{ id, state: \"waiting\" }`, as agent_chat_post. You are an agent in these chats, never the owner: everything you post is marked as yours on every member's phone. Only chats the owner added you to answer; any other chat is refused. No unlock window is needed: what you read was sealed to this connection alone.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "thread": {      "type": "string",      "description": "The chat, as agent_chats names it."     },     "message": {      "type": "string",      "description": "The message id, from agent_chat_read."     },     "emoji": {      "type": "string",      "description": "One emoji."     }    },    "required": [     "thread",     "message",     "emoji"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "agent_chat_state",   "title": "Whether your post went",   "description": "Where one of your posts or reactions stands, by the id agent_chat_post or agent_chat_react answered: `{ id, state: \"waiting\" | \"sent\" | \"failed\", error? }`.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The id agent_chat_post or agent_chat_react answered."     }    },    "required": [     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "list_bin",   "title": "List the bin",   "description": "The records waiting in the bin, the latest binned first: what delete_record moved there from a table with a bin (a `trashed_at` or `deleted_at` column, holding the moment it went). Name `table` for one table's bin; absent, every table's. Each record is answered as get_record_by_table answers one, `deleted_at` the moment it was binned. `more: true` says there were more than `limit`. Bring one back with restore_from_bin; erase them for good with empty_bin.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "Only this table's bin, by the table's id: \"person\", \"note\", \"photo\"."     },     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 200,      "description": "How many records to return (default 25, at most 200)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "restore_from_bin",   "title": "Restore a record from the bin",   "description": "Bring one binned record back, by the table's id and the record's id: its bin mark is cleared and it is back in every list, in one write. Answers `{ change, record }` as update_record does. Refused for a record that is not in the bin, or a table with no bin.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The table's id, as list_bin answered it."     },     "id": {      "type": "string",      "description": "The record's id."     }    },    "required": [     "table",     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "empty_bin",   "title": "Empty the bin",   "description": "ERASE binned records for good: every record in `table`'s bin, or in every table's bin when no table is named, or only those binned before `older_than`. Nothing brings an erased record back — say what you are about to erase (list_bin) and let the user answer first. Messages, chats and photos are never erased here (their bins hold what a chat's timer, a declined group or the photo prune binned, not the user): only the owner's devices empty those, and naming one is refused. At most 1000 go in one call, the longest binned first; `more: true` says some are left. Answers `{ erased, tables, more, left_for_the_owner? }`: how many went, how many from each table, and the bins left for the owner's devices.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "Only this table's bin, by the table's id."     },     "older_than": {      "type": "string",      "description": "Only records binned before this moment: a day (YYYY-MM-DD, from its start in the owner's zone) or an instant with its offset (2026-10-25T09:00:00Z)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "undo",   "title": "Undo a change",   "description": "Take back one change a write made, by its `change_id` (every write answers one; list_changes lists them): a record it made is deleted, a record it deleted or binned comes back holding what it held, columns it changed are written back as they were. Refused with `changed_since` when the record was written after the change — undoing then would overwrite a later write — and when the change was already undone. The undo is itself a change: undo its `change_id` to do the change again. Answers `{ undone, record, change_id }`: the change taken back (its `undone_by` now set), the record as it now stands (null when the undo deleted it), and the undo's own change. Refused too for an import's write (the Mac's mail, WhatsApp and calls readers): the log keeps only that it happened.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "change_id": {      "type": [       "integer",       "string"      ],      "description": "The change's id: a write's `change_id`, or one from list_changes."     }    },    "required": [     "change_id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "restore_version",   "title": "Put a record back as a change left it",   "description": "Rewrite one record to how it stood right after one of its changes (from list_changes { table, id }): every column that differs is written back, a deleted record comes back, and a change that deleted it deletes it again. It is an ordinary write with its own `change_id`, so undo takes it back. Refused when the record already reads that way, or when the change is another record's. Answers `{ restored, record, change_id }`.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The record's table, by its id."     },     "id": {      "type": "string",      "description": "The record's id."     },     "change_id": {      "type": [       "integer",       "string"      ],      "description": "The change's id: a write's `change_id`, or one from list_changes."     }    },    "required": [     "table",     "id",     "change_id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "list_changes",   "title": "List the changes",   "description": "The change log, the latest first: every write an act or a tool made to a record, each with its `change_id`, when (`at`), who (`byline`), what it came through (`via`, the tool or act), its `kind` (create, update, delete, restore, act, or import: an import's write, kept only as having happened, its before and after null), the columns it changed `before` and `after`, and `undone_by` when an undo took it back. Name `table` and `id` for one record's history, `since` (an instant) for the recent ones. The log keeps 90 days. `more: true` says there were more than `limit`.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "Only this table's changes, by the table's id."     },     "id": {      "type": "string",      "description": "Only this record's changes."     },     "since": {      "type": "string",      "description": "An ISO-8601 instant; only changes at or after it."     },     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 200,      "description": "How many changes to return (default 50, at most 200)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "summarize_records",   "title": "Summarize a table",   "description": "Figures over one table's records, worked out where they live — never page a table through list_records to add it up. `measures` is a list of { column, op }: op `count` (column optional: with one, the records where it is filled), or `sum`, `avg`, `min`, `max` of a number or amount column (`min` and `max` also take a date or text). `where` narrows the records exactly as list_records' does. `group_by` names a column: one group per value it holds, in the value's order (an empty one is null, last), at most 200 groups, `more: true` when there were more. Binned records are never counted; archived ones are. Each figure is keyed `<op>_<column>` (`count` alone for a plain count); an amount stays whole minor units, an avg is a number. Answers `{ table, groups: [{ <group_by>: value, …figures }], more }`.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "description": "The table's id: \"transaction\", \"todo\", \"book\"."     },     "measures": {      "type": "array",      "description": "What to work out: [{ \"column\": \"amount_minor\", \"op\": \"sum\" }, { \"op\": \"count\" }].",      "items": {       "type": "object",       "properties": {        "column": {         "type": "string"        },        "op": {         "type": "string",         "enum": [          "count",          "sum",          "avg",          "min",          "max"         ]        }       },       "required": [        "op"       ],       "additionalProperties": false      }     },     "where": {      "type": "object",      "description": "Narrow the records, as list_records' where does."     },     "group_by": {      "type": "string",      "description": "A column key: one group per value it holds."     }    },    "required": [     "table",     "measures"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "storage_summary",   "title": "What the database holds",   "description": "How much this database holds against its caps: its own file's bytes and its cap, the media bytes it keeps (photos, documents) and their cap, each with a warning from 80% full, and each table's records — live, deleted ones it still remembers (tombstones a phone drops), and the bytes their values take — the largest first, with the change log's length. Also where the file's bytes go (`parts`): every store table and index (the records, the search index, the change log, the act log and the rest), its entries and the bytes they carry, and the overhead left over; sizes only, never a value. It reads every part once, so parts: false leaves them out for a quick answer. `worker` names the Worker version that answered. Read it before a large import, or when the user asks how big their database is.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "parts": {      "type": "boolean",      "description": "false leaves out where the file's bytes go, part by part (on by default)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "merge_people",   "title": "Merge two people",   "description": "Fold a duplicate person (`merge`) into the one who stays (`keep`), in one write. `keep` gains what `merge` held and they did not — an empty column fills, a list column combines without repeats, nothing `keep` holds is overwritten — and `merge`'s Contacts card moves to `keep` when only `merge` had one. Every record that links `merge` through a person link its table declares (their handles — phones and emails —, calls, faces, notes and the rest) is moved to `keep`; one that repeats a record `keep` already has (the same title and choices, as a phone number held twice) goes to the bin. `merge` goes to the bin last, so restore_from_bin brings them back, though the moved records stay with `keep`. Refused when either is not a person, is in the bin, or both are one person. Answers what moved: `{ kept, merged, filled, combined, device_card, repointed, repeats_binned, said }` — `repointed` counts the records moved by `table.column`. Say who you are about to merge and let the user answer first.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "keep": {      "type": "string",      "description": "The id of the person who stays."     },     "merge": {      "type": "string",      "description": "The id of the duplicate, folded into keep and binned."     }    },    "required": [     "keep",     "merge"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "get_media",   "title": "Get a record's file",   "description": "The file a record keeps — a photo, a document, a person's picture, any record with a photo or file column — by the record's id (`table` narrows the look; absent, every table that keeps files is looked in). A picture comes as an image you can see: whole when it is at most 3.5 MB and a JPEG, PNG, GIF or WebP, else drawn as WebP at most 1568 pixels a side, or at `width`/`height` when they are given. Any other file comes whole as an embedded resource, at most 8 MB; a bigger one is refused — read its record's extracted text instead. A record that keeps a list of files (a message's `media`) gives one at a time by `index`, from 0. A picture sent or kept in a chat in Comms has no photo row: read it from its message, `{ table: \"message\", id, index }`. A text block beside it says `{ table, id, column, key, content_type, bytes }`, `index` and `files` for a list, and `drawn` when the picture was drawn.",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The record's id: a photo's, a document's, a person's."     },     "table": {      "type": "string",      "description": "The record's table, by id: \"photo\", \"document\", \"person\", \"message\"."     },     "index": {      "type": "integer",      "minimum": 0,      "description": "A record that keeps a list of files (a message's pictures): which one, from 0. Absent, the first."     },     "width": {      "type": "integer",      "minimum": 1,      "maximum": 4096,      "description": "A picture only: draw it at most this many pixels wide."     },     "height": {      "type": "integer",      "minimum": 1,      "maximum": 4096,      "description": "A picture only: draw it at most this many pixels high."     }    },    "required": [     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "put_document",   "title": "Add a document",   "description": "Store a file and make its document record: give its `name` and the file as `bytes_base64` or as a `url` to fetch (one of them). The bytes are kept once, by their content, at most 100 MB, and count against the database's media; past either cap it is refused and nothing is made. `kind` is the document's type when you know it — one of the document table's doc_type choices: a statement, an invoice, a receipt, a letter and the rest. `content_type` says what the bytes are when the name and the url do not. Answers `{ change, record, stored }` as create_record does; `stored: false` says the same bytes were already held. Read it back with get_media.",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "name": {      "type": "string",      "description": "The file's name, as a person reads it: \"March statement.pdf\". Its title is the name without the extension."     },     "kind": {      "type": "string",      "description": "The document's type, one of the document table's doc_type choices (\"invoice\", \"receipt\", \"letter\", \"other\")."     },     "bytes_base64": {      "type": "string",      "description": "The file's bytes, base64."     },     "url": {      "type": "string",      "description": "An http or https address to fetch the file from."     },     "content_type": {      "type": "string",      "description": "The file's media type (\"application/pdf\"); absent, it is read from the url's answer or the name's extension."     }    },    "required": [     "name"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": true   }  },  {   "name": "export_open_bundle",   "title": "Export a library in open formats",   "description": "Lay one kit's library out in the formats other apps open, zipped and kept as a document of the owner's: `books` as Author/Title folders with each book file, its cover and a metadata.opf, OPDS catalogues (catalog.json, catalog.xml) and a goodreads.csv, highlights as Markdown and Web Annotations; `music` as Artist/Album folders of the song files with covers, playlists as .m3u8 and listens.jsonl for ListenBrainz; `podcasts` as subscriptions.opml and gpodder episode_actions.json; `films` as a Kodi tree (Jellyfin, Plex and Infuse read it too) with NFOs, posters, subtitles and trakt-watched.json. Files are copied as stored, never converted; a key a record names whose file is not stored is listed in `missing_media`, its record's metadata kept. `media: false` leaves the files out and keeps the lists and metadata alone. The ZIP is at most 2 GB, counts against the database's media, and is refused past either cap with what to leave out; an empty library is refused. The owner's alone. Answers `{ document, files, missing_media, bytes }`: `document` is the new document record's id, named \"<Kit> library, <date>\" — Documents lists it, and get_media hands it over when it is at most 8 MB.",   "scope": "owner",   "inputSchema": {    "type": "object",    "properties": {     "kit": {      "type": "string",      "enum": [       "books",       "music",       "podcasts",       "films"      ],      "description": "Which library: books, music, podcasts or films."     },     "media": {      "type": "boolean",      "description": "Copy the files themselves (book files, songs, films, covers) into the ZIP. Default true; false keeps the lists and metadata alone."     }    },    "required": [     "kit"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_scene_write",   "title": "Write a scene of a story",   "description": "Write one scene of a Cotton Story screenplay, keeping the story's rules: the body is plain Fountain without its heading (see the Story tool's instructions: a name alone on a line, what they say under it, asides in brackets, action as plain sentences, a blank line between elements). Send only what changes. `heading` typed whole (INT. KITCHEN - NIGHT) sets setting, place and time; or send `setting` (INT., EXT., INT./EXT.), `place` (a place NAME) and `time` (DAY, NIGHT or any words) and the heading is written from them. Words, pages, minutes and who speaks are worked out, never sent; a place or a speaker the story has no row for is made, and every character's scenes and lines are counted again. Without `id` it makes a new scene: at the end of `story`, or right after scene `after` (the scenes below move down). Answers `{ scene: { id, story, heading, setting, place, time, words, pages, minutes, speakers }, made: { characters, places } }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The scene's id; absent, a new scene is made."     },     "story": {      "type": "string",      "description": "The story's id (list_records { table: \"story_story\" }). A new scene goes at its end."     },     "after": {      "type": "string",      "description": "A new scene goes right after this scene."     },     "body": {      "type": "string",      "description": "The whole body in Fountain, without the heading line."     },     "heading": {      "type": "string",      "description": "The scene heading typed whole, like INT. KITCHEN - NIGHT."     },     "setting": {      "type": "string",      "enum": [       "INT.",       "EXT.",       "INT./EXT."      ]     },     "place": {      "type": "string",      "description": "The place's name, like KITCHEN."     },     "time": {      "type": [       "string",       "null"      ],      "description": "DAY, NIGHT or any time words; null clears it."     },     "summary": {      "type": [       "string",       "null"      ],      "description": "One line: what happens."     },     "status": {      "type": "string",      "enum": [       "idea",       "draft",       "done"      ]     },     "day": {      "type": [       "number",       "null"      ],      "description": "The story day this scene happens on (1, 2, 3...); null clears it."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_scene_move",   "title": "Move a scene earlier or later",   "description": "Move a scene of a story: `by` -1 one earlier, 1 one later, or `to` a position from 1. The story's scenes are numbered 1, 2, 3... again. Answers `{ positions: [ { id, position } ] }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The scene's id."     },     "by": {      "type": "integer",      "description": "-1 one earlier, 1 one later."     },     "to": {      "type": "integer",      "minimum": 1,      "description": "The position to move to, from 1."     }    },    "required": [     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_copy",   "title": "Copy a story for translating",   "description": "Make a whole copy of a story for translating it: a new story in `language` linked by translation_of, with every scene (same order, headings and bodies, ready to be rewritten line by line), character, place and note. Translate a scene's body with story_scene_write on the copy; keep names on their own lines and the blank lines where they are. Answers `{ story, scenes }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "story": {      "type": "string",      "description": "The story's id (list_records { table: \"story_story\" })."     },     "language": {      "type": "string",      "description": "The language the copy is for, like Telugu."     }    },    "required": [     "story",     "language"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_fountain_write",   "title": "Read a whole story as Fountain",   "description": "The whole story as one Fountain file, the plain-text screenplay format every screenwriting app opens: its title page, then each scene's heading, its summary as a synopsis line (= ...) and its body, in order. Read this to read or review a whole screenplay at once. Answers `{ text, name }`. Story is sealed: this reads inside the owner's window (request_unlock).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "story": {      "type": "string",      "description": "The story's id (list_records { table: \"story_story\" })."     }    },    "required": [     "story"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_fountain_read",   "title": "Bring in a Fountain file as a new story",   "description": "Make a new story from Fountain text: the title page's Title and Author, a scene at each scene heading, a synopsis line under a heading as the scene's summary, and the characters and places it names. Answers `{ story, scenes, characters, places }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "text": {      "type": "string",      "description": "The Fountain file's text."     },     "name": {      "type": "string",      "description": "The file's name; its stem titles a story whose title page has no Title."     }    },    "required": [     "text"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_line_write",   "title": "Write one line of a scene",   "description": "Add or change one line of a scene, keeping every other line and its id: `kind` is action, dialogue (speech; name its `character`, a story_character id), note (a note to self) or enters (someone entering; name the `character`). Without `id` it adds a line after line `after` (`start` for the first place; absent, at the end); with `id` it changes that line. `aside` is how a speech is said, like quietly. The scene's Fountain body, figures and the characters' counts are kept from the lines. Answers `{ line, lines: [ { id, kind, who, character, aside, text } ] }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "scene": {      "type": "string",      "description": "The scene's id."     },     "id": {      "type": "string",      "description": "The line to change; absent, a new line."     },     "after": {      "type": "string",      "description": "A new line goes after this line's id, or `start`."     },     "kind": {      "type": "string",      "enum": [       "action",       "dialogue",       "note",       "enters"      ]     },     "text": {      "type": "string",      "description": "What the line says."     },     "character": {      "type": "string",      "description": "Who speaks or enters: a story_character id."     },     "aside": {      "type": [       "string",       "null"      ],      "description": "How a speech is said, like quietly; null clears it."     }    },    "required": [     "scene"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_line_remove",   "title": "Take one line out of a scene",   "description": "Take one line out of a scene (it goes to Deleted); every other line keeps its id. Answers `{ removed }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "scene": {      "type": "string",      "description": "The scene's id."     },     "id": {      "type": "string",      "description": "The line's id."     }    },    "required": [     "scene",     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "story_scene_split",   "title": "Split a scene in two",   "description": "Split a scene at a line: a new scene right after it holds the lines from `at` on, each keeping its id, at the same place and time. Answers `{ scene }`, the new scene. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The scene's id."     },     "at": {      "type": "string",      "description": "The id of the line the new scene starts with."     }    },    "required": [     "id",     "at"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_scene_merge",   "title": "Merge a scene into another",   "description": "Merge scene `id` into scene `into`: its lines follow `into`'s, each keeping its id, its pictures, things, costumes and notes go with them, and `id` goes to Deleted. Answers `{ scene }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The scene that goes."     },     "into": {      "type": "string",      "description": "The scene that stays."     }    },    "required": [     "id",     "into"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "story_rename",   "title": "Rename a character or a place everywhere",   "description": "Rename a character (story_character) or a place (story_place) and every place the script names them: a character in every speech, a place in every scene heading. Lines keep their ids. Answers `{ scenes }`, how many scenes changed. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "enum": [       "story_character",       "story_place"      ]     },     "id": {      "type": "string",      "description": "The character's or place's id."     },     "name": {      "type": "string",      "description": "The new name."     }    },    "required": [     "table",     "id",     "name"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_merge",   "title": "Merge two characters or two places",   "description": "Make two characters or two places one: every speech of `id` becomes `into`'s (or every scene at place `id` moves to `into`), its pictures, costumes and uses move with it, and `id` goes to Deleted. `into`'s own name and words stand. Answers `{ scenes, into }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "table": {      "type": "string",      "enum": [       "story_character",       "story_place"      ]     },     "id": {      "type": "string",      "description": "The row that goes."     },     "into": {      "type": "string",      "description": "The row that stays."     }    },    "required": [     "table",     "id",     "into"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "story_picture_add",   "title": "Add a picture to a place, a person or a scene",   "description": "Keep a picture beside a story: of a place, a person, a person on one story day (a costume: the character and `day`, or the costume), a costume, a thing or one scene, named in `of`. Give the picture as `bytes_base64` or a `url` (a JPEG, PNG, GIF, WebP or HEIC, at most 100 MB). Answers `{ picture: { id, picture } }`; read it back with get_media { table: \"story_picture\", id }. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "of": {      "type": "object",      "description": "What the picture is of: one or more of character, place, scene, costume, thing, each an id of the same story.",      "properties": {       "character": {        "type": "string"       },       "place": {        "type": "string"       },       "scene": {        "type": "string"       },       "costume": {        "type": "string"       },       "thing": {        "type": "string"       }      },      "additionalProperties": false     },     "day": {      "type": "number",      "description": "The story day, for a person's picture on that day."     },     "caption": {      "type": "string",      "description": "A short caption."     },     "bytes_base64": {      "type": "string",      "description": "The picture's bytes, base64."     },     "url": {      "type": "string",      "description": "Where to fetch the picture from."     },     "name": {      "type": "string",      "description": "The file's name, like rooftop.jpg."     },     "content_type": {      "type": "string",      "description": "The picture's type, like image/jpeg."     }    },    "required": [     "of"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": true   }  },  {   "name": "story_draft_mark",   "title": "Mark the script as a named draft",   "description": "Mark the story as it stands now as a named, dated draft (\"Second draft\"), frozen: every scene and line kept with its id. Writing goes on in the story itself. Answers `{ draft, scenes }`. List drafts with list_records { table: \"story_draft\", where: { story } }. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "story": {      "type": "string",      "description": "The story's id (list_records { table: \"story_story\" })."     },     "name": {      "type": "string",      "description": "The draft's name, like Second draft."     }    },    "required": [     "story",     "name"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "openWorldHint": false   }  },  {   "name": "story_draft_read",   "title": "Read a draft",   "description": "A draft as it was marked: its scenes in order, each line with its id, and the whole draft as Fountain (`text`, `name`). Answers `{ draft, scenes, text, name }`. Story is sealed: this reads inside the owner's window (request_unlock).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "draft": {      "type": "string",      "description": "The draft's id (list_records { table: \"story_draft\" })."     }    },    "required": [     "draft"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_draft_changes",   "title": "What changed since a draft",   "description": "What changed in the story since a draft, told by identity, never by position: each scene added, removed, moved, changed or the same, with its number then and now, its heading then and now when that changed, and how many lines were added, removed and changed; `since` totals them. Answers `{ draft, scenes, since }`. Story is sealed: this reads inside the owner's window (request_unlock).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "draft": {      "type": "string",      "description": "The draft's id."     }    },    "required": [     "draft"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_draft_restore",   "title": "Go back to a draft",   "description": "Make the story the draft again: its scenes in its order, with their headings, summaries and lines, each line its own id again; scenes made since go to Deleted, where they can come back from. Going back is a change like any other: history keeps what stood before. Do this only when the owner asks. Answers `{ scenes, draft }`. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "draft": {      "type": "string",      "description": "The draft's id."     }    },    "required": [     "draft"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": true,    "openWorldHint": false   }  },  {   "name": "recordings_to_summarise",   "title": "Recordings waiting for a summary",   "description": "The owner's recordings (meetings, voice memos, notes taken on a call) that have their words and no summary yet, or whose summary they asked for again, newest first: each its id, title, when it started, how long, its languages and how many lines. Cotton makes no summary itself: the owner's own assistant does, with recording_read then recording_summary_write. Answers `{ recordings, more }`. Recordings are sealed: this reads inside the owner's grant (Recordings).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "limit": {      "type": "integer",      "minimum": 1,      "maximum": 100,      "description": "At most this many (20 when left out)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "recording_read",   "title": "Read a recording",   "description": "One recording's words: its speakers (a label such as S1, and the name the owner gave), every line in order with its time, speaker and language, and the whole transcript as one text (`17 [3:12] Asha (S2): words`), with the summary and actions it has. Answers `{ recording, speakers, lines, transcript, actions }`. Recordings are sealed: this reads inside the owner's grant (Recordings).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The recording's id (recordings_to_summarise)."     }    },    "required": [     "id"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "recording_summary_write",   "title": "Write a recording's summary",   "description": "Write the summary and the actions onto a recording, after reading it with recording_read: `points`, the summary, a few short points in the recording's own language, each a whole sentence; `actions`, each one thing to be done, starting with a verb, with `who` (a speaker's label such as S2, or a name the recording says), and `due` (YYYY-MM-DD) or `due_said` (the words the recording used) where it said them. Quote what was said: never invent a line, a speaker's name, a decision or a task; leave out who or when it did not say. `by` is your own name (Claude). Writing again replaces the summary and the actions, except those the owner already added to their to-dos. The phone shows it at its next sync. Answers `{ recording, summary, actions, made, kept }`. Recordings are sealed: this writes inside the owner's grant (Recordings).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "id": {      "type": "string",      "description": "The recording's id."     },     "points": {      "type": "array",      "items": {       "type": "string"      },      "minItems": 1,      "description": "The summary, one point a string."     },     "actions": {      "type": "array",      "items": {       "type": "object",       "properties": {        "words": {         "type": "string"        },        "who": {         "type": "string"        },        "due": {         "type": "string",         "description": "YYYY-MM-DD"        },        "due_said": {         "type": "string"        },        "at_ms": {         "type": "integer",         "description": "Where in the recording it was said, in ms."        }       },       "required": [        "words"       ],       "additionalProperties": false      },      "description": "The things to be done; none when the recording named none."     },     "by": {      "type": "string",      "description": "Your own name, shown as who made the summary."     }    },    "required": [     "id",     "points"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_fdx_write",   "title": "Read a whole story as a Final Draft file",   "description": "The whole story as a Final Draft file (.fdx, XML), the format the common desktop screenwriting tool opens: its title page, then each scene's heading and its action, character, parenthetical, dialogue and transition paragraphs. Answers `{ text, name }`. Story is sealed: this reads inside the owner's window (request_unlock).",   "scope": "read",   "inputSchema": {    "type": "object",    "properties": {     "story": {      "type": "string",      "description": "The story's id."     }    },    "required": [     "story"    ],    "additionalProperties": false   },   "annotations": {    "readOnlyHint": true,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  },  {   "name": "story_move_old",   "title": "Move old scripts into Story's new shape",   "description": "The one-off move of scripts written before every line was a row: each scene whose lines are not yet story_line rows gets them (a row it already holds keeps its id; a row made twice loses its copy), a line naming its speaker only by name is linked to that character, and character counts are taken again. A scene that would lose a word, or holds a line row its text no longer says, is left as it is and counted. Without confirm it is a dry run that writes nothing. It answers counts only, never a title or a line: what it found, the work to do, and on a real run what was done and how many scenes are left. A real run moves at most limit scenes; call it again until none are left. Running it again changes nothing. Run it only when the owner or the coordinator asks. Story is sealed: this works inside the owner's window (request_unlock).",   "scope": "write",   "inputSchema": {    "type": "object",    "properties": {     "confirm": {      "type": "boolean",      "description": "true to write; absent or false is a dry run."     },     "limit": {      "type": "integer",      "minimum": 1,      "description": "At most this many scenes moved in one call (default 25)."     }    },    "additionalProperties": false   },   "annotations": {    "readOnlyHint": false,    "destructiveHint": false,    "idempotentHint": true,    "openWorldHint": false   }  } ]}