Add the write tools with scope, daily caps and a bounded wait #30
No reviewers
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp!30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/write-tools"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #13. Part of the phase 2 epic (ADR 0004).
What changes
mail_draft,mail_flag,mail_move,mail_undoandmail_actions.build_appregisters them only whenauth.write_token_fileis set.actions, and polls for up towrites.wait_seconds(default 10) for the sync worker to settle it.action=N kind=K state=applied, withdraft_id=for a draft andids=for a move. It isstate=queuedwhen the wait runs out.Error:line that names the action id.server.pystill makes no IMAP call.[writes]sets per-day caps per kind: drafts 20, flags 100, moves 20, undos 50. The count and the insert share one transaction, so concurrent calls cannot pass the cap together. Over the cap the tool answersrate_limitedand queues nothing.X-Mailmind-Action: <id>, so a draft the bot wrote can be told apart and matched tomail_actions. A subject tag would go out if the owner sent the draft, so there is none.mail_actionslistsid | kind | state | code | requested | applied | detailand never echoes a body.config.example.tomlgains[writes].On "insufficient_scope"
FastMCP hides a tool from a token that lacks its scope. The read token therefore does not see the write tools in
tools/list, and a call to one fails as an unknown tool. It does not get aninsufficient_scopeerror. The tests assert that each call fails and that nothing is queued. For the starbase#271 evidence, record that a write tool is absent and its call fails, rather than aninsufficient_scopestring.Tests
make check: 79 unit tests pass, plus ruff, mypy --strict and pip-audit. New tests cover:queuedwhen no worker runs;make test-integration: 7 pass against GreenMail. The new one runs the deployed shape: an api on a read-only store and a separaterun_foreverworker loop.mail_draftover HTTP comes backapplied, the server copy carriesX-Mailmind-Action, andmail_undoremoves the draft.🤖 Generated with Claude Code