{"pair": "todos and secrets","rust": "crates/cotton-tools/src/mcp/handlers/records_1/todos.rs, handlers/secrets.rs","worker": "apps/business/src/mcp/tools/records/todos.ts, records/secrets.ts","cases": [ {"name": "create a todo due at an instant, then list it","steps": [ {"tool": "create_todo","args": {"title": "Water the ferns","dueAt": "2026-12-01T09:30:00Z","priority": "high" },"expect": {"answer": {"id": "<id1>","title": "Water the ferns","due_at": "<instant>","status": "open","dueDate": "2026-12-01","dueTime": "15:00" } } }, {"tool": "list_todos","args": {},"expect": {"answer": {"more": false,"timezone": "Asia/Kolkata","todos": [ {"id": "<id1>","title": "Water the ferns","status": "open","dueAt": "<instant>","dueDate": "2026-12-01","dueTime": "15:00","projects": [] } ] } } } ] }, {"name": "a todo on a day at a time in a named zone","steps": [ {"tool": "create_todo","args": {"title": "Call the plumber","dueDate": "2026-12-02","dueTime": "18:15","timezone": "Asia/Kolkata" },"expect": {"answer": {"id": "<id1>","title": "Call the plumber","due_at": "<instant>","status": "open","dueDate": "2026-12-02","dueTime": "18:15" } } } ] }, {"name": "mark a todo done, then change nothing","steps": [ {"tool": "create_todo","args": {"title": "Return the library book" },"expect": {"answer": {"id": "<id1>","title": "Return the library book","due_at": null,"status": "open" } } }, {"tool": "update_todo","args": {"id": "{{0.id}}","status": "done" },"expect": {"answer": {"id": "<id1>","title": "Return the library book","notes": null,"status": "done","due_at": null,"snoozed_until": null,"priority": 0,"completed_at": "<instant>" } } }, {"tool": "update_todo","args": {"id": "{{0.id}}" },"expect": {"refusal": "nothing to change — pass a field to change" } } ] }, {"name": "todo refusals","steps": [ {"tool": "create_todo","args": {},"expect": {"refusal": "title is required" } }, {"tool": "create_todo","args": {"title": "x","dueTime": "09:00" },"expect": {"refusal": "dueTime needs dueDate — a time is a time on a day" } }, {"tool": "create_todo","args": {"title": "x","dueAt": "2026-12-01T09:30:00Z","dueDate": "2026-12-01" },"expect": {"refusal": "pass dueAt OR dueDate/dueTime, not both — they name the same moment" } }, {"tool": "create_todo","args": {"title": "x","rrule": "FREQ=WEEKLY;BYDAY=MO" },"expect": {"refusal": "a repeating todo needs a due — it anchors the series' first occurrence" } }, {"tool": "create_todo","args": {"title": "x","priority": "urgent" },"expect": {"answer": {"id": "<id1>","title": "x","due_at": null,"status": "open" } } }, {"tool": "update_todo","args": {"id": "00000000-0000-4000-8000-000000000999","status": "done" },"expect": {"refusal": "no todo with id 00000000-0000-4000-8000-000000000999" } }, {"tool": "list_todos","args": {"dueAfter": "2026-12-02T00:00:00Z","dueBefore": "2026-12-01T00:00:00Z" },"expect": {"refusal": "dueAfter must be before dueBefore" } }, {"tool": "list_todos","args": {"cursor": "not-a-cursor" },"expect": {"refusal": "cursor is not one list_todos handed out — pass nextCursor from the previous page exactly as it came, or drop it to start the list again" } } ] }, {"name": "secret refusals","steps": [ {"tool": "create_secret","args": {"service": "example","value": "v" },"expect": {"refusal": "name is required" } }, {"tool": "create_secret","args": {"name": "No service","value": "v" },"expect": {"refusal": "service is required for an api key — it is how the key is found again ('anthropic', 'openai')" } }, {"tool": "create_secret","args": {"name": "Bad service","service": "Not Ok","value": "v" },"expect": {"refusal": "service must be lowercase letters, digits, dots, hyphens or underscores, starting with a letter or a digit — 'anthropic', 'openai', 'my-bank'" } }, {"tool": "create_secret","args": {"name": "Empty","service": "example","value": "" },"expect": {"refusal": "value is empty — pass the credential itself, or delete_secret to bin one" } }, {"tool": "create_secret","args": {"name": "Both","service": "example","value": "v","fields": {"key": "v" } },"expect": {"refusal": "pass value OR fields, not both — value is the one primary field, fields is the whole typed payload" } }, {"tool": "create_secret","args": {"name": "Odd kind","kind": "recipe","value": "v" },"expect": {"refusal": "kind must be one of login, api_key, note, card, identity, document, code, wifi, address, file" } }, {"tool": "list_secrets","args": {"kind": "recipe" },"expect": {"refusal": "kind must be one of login, api_key, note, card, identity, document, code, wifi, address, file" } } ] } ],"differs": [ {"name": "create an api key and list it, never the value","why": "The Worker writes and lists no hint (keys CONTRACT S2: the server never holds part of a value; the phone works out the tail from the sealed value); the phone's own tools still keep one beside the value it holds.","steps": [ {"tool": "create_secret","args": {"name": "Example API key","service": "example","value": "sk-test-0000000000abcd" },"rust": {"answer": {"id": "<id1>","kind": "api_key","name": "Example API key","service": "example","hint": "abcd" } },"worker": {"answer": {"id": "<id1>","kind": "api_key","name": "Example API key","service": "example" } } }, {"tool": "list_secrets","args": {},"rust": {"answer": {"secrets": [ {"id": "<id1>","kind": "api_key","name": "Example API key","service": "example","hint": "abcd","createdAt": "<instant>","updatedAt": "<instant>","isSet": true } ] } },"worker": {"answer": {"secrets": [ {"id": "<id1>","kind": "api_key","name": "Example API key","service": "example","createdAt": "<instant>","updatedAt": "<instant>","isSet": true } ] } } } ] }, {"name": "a login secret with a site and a username","why": "The Worker writes and lists no hint (keys CONTRACT S2: the server never holds part of a value; the phone works out the tail from the sealed value); the phone's own tools still keep one beside the value it holds.","steps": [ {"tool": "create_secret","args": {"name": "Example bank","kind": "login","site": "https://bank.example.test","username": "ada","value": "hunter2-synthetic" },"rust": {"answer": {"id": "<id1>","kind": "login","name": "Example bank","site": "https://bank.example.test","username": "ada","hint": "etic" } },"worker": {"answer": {"id": "<id1>","kind": "login","name": "Example bank","site": "https://bank.example.test","username": "ada" } } }, {"tool": "list_secrets","args": {"kind": "login" },"rust": {"answer": {"secrets": [ {"id": "<id1>","kind": "login","name": "Example bank","site": "https://bank.example.test","username": "ada","hint": "etic","createdAt": "<instant>","updatedAt": "<instant>","isSet": true } ] } },"worker": {"answer": {"secrets": [ {"id": "<id1>","kind": "login","name": "Example bank","site": "https://bank.example.test","username": "ada","createdAt": "<instant>","updatedAt": "<instant>","isSet": true } ] } } } ] }, {"name": "the undo envelope on a write's answer","why": "The Worker adds change_id and undoable (and changes) to every write's answer; the phone answers none. Every other step leaves them out (normalisation rule 5).","steps": [ {"tool": "create_todo","args": {"title": "Descale the kettle" },"envelope": true,"rust": {"answer": {"id": "<id1>","title": "Descale the kettle","due_at": null,"status": "open" } },"worker": {"answer": {"id": "<id1>","title": "Descale the kettle","due_at": null,"status": "open","change_id": "<volatile>","undoable": true } } } ] } ]}