Skip to content

feat(mcp): agents read calendars, tasks and contacts in their scope - #82

Merged
bketelsen merged 1 commit into
mainfrom
agent-pim/reads
Oct 19, 2026
Merged

bketelsen merged 1 commit into
mainfrom
agent-pim/reads

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Plan 0012's first part (M8.5, ADR-0042): agents can read the user's calendars, tasks and contacts through /mcp/mail, but only for the accounts their scope reaches.

What changes

The IDL opens these methods to caller agent:

  • account.collections;
  • calendar.range and calendar.event;
  • tasks.list, and the new tasks.get;
  • people.list and people.get.

Nothing that writes is opened. Every event write, tasks.delete, the other people methods and vip stay methodNotFound to agents under every scope, ;write;send included. The tests check each of them.

The engine keeps an agent to its scope (internal/engine/scope.go):

  • another account's calendar, event, task list, task, address book or person is notFound, and lists skip them;
  • under account=<id>, a person is made of that scope's contacts alone. Their name, organization and search match come from those contacts (new store.ScopedPeople and store.ScopedPerson), so another account's contact can't leak a name or match a query.

New read tools, all readOnlyHint and offered under every scope:

Tool What it does
list_collections the scope's enabled calendars, task lists and address books
list_events occurrences in a range of days (up to 31), with clashes: busy timed pairs that overlap, at most 50, with clash_count
read_event one event or occurrence, with up to 100 attendees
list_tasks tasks due today, overdue, undated, or all, in time_zone, optionally in one list
read_task one task
search_contacts people matching a query
read_contact one person and their contacts
  • Each text is cut at 32 KiB.
  • The notice now names calendars, tasks and contacts.
  • lodge.Options.Now gives the tools a clock, so "today" can be tested.

Docs:

  • the Methods and callers table and the status of the PIM section in specs/lodge-app.md;
  • plan 0012's status;
  • in the spec, list_collections lists enabled collections only, and list_events answers clash_count.

Tests

Through kittest and the MCP SDK client (internal/lodge/mcp_pim_test.go, mcp_pim_limits_test.go):

  • Scope: each read method on an agent's connection, against a second account with its own calendar, task list and address book. Ada is in both accounts' address books.
  • Tools:
    • busy versus free, declined and cancelled events;
    • a clash at its exact overlap;
    • Berlin times;
    • "today" in Kiritimati;
    • other accounts' data as errors.
  • Every limit at its value and one past it:
    • list_events: 31 and 32 days, limit 1, 200, -1 and 201, and 50 and 51 clashes;
    • read_event: 100 and 101 attendees;
    • list_tasks: limit 1, 100, -1 and 101;
    • search_contacts: a 256-byte query and a 257-byte one, limit 50 and 51;
    • texts of 32 KiB and one byte over.

I checked that the tests can fail: with the scope filter turned off, both scope tests fail.

Gates

make check, make build-windows and make ui-check (nsl, 1,327 tests) pass. The app's only change is in generated types.

The waiting queries and the task and Remind Me writes follow in the next PRs, which build on this one.

🤖 Generated with Claude Code

Plan 0012's reads (ADR-0042). The IDL opens account.collections,
calendar.range, calendar.event, tasks.list, people.list and people.get
to agents, and adds tasks.get. The engine keeps an agent to its scope's
accounts: another account's calendar, event, task list, task, address
book or person is notFound, lists skip them, and under account=<id> a
person is made of the scope's contacts alone, name and search included.

/mcp/mail gains list_collections, list_events (with clashes),
read_event, list_tasks, read_task, search_contacts and read_contact,
each with its limits, and a notice that now names calendars, tasks and
contacts. The tools take their clock from lodge.Options.Now, so "today"
is testable. kittest and the SDK client test the scope, the tools and
every limit at and past its value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant