get_reading
Returns the current value of one reading of an App Kit (an app's unread count, a label, a script's answer), with when it changed and whether it is stale.
Details #
An App Kit declares readings: named values it keeps current from an app. get_reading returns one, for an agent that wants to know "how many unread messages does Mail show" without driving the app.
{ "jsonrpc": "2.0", "id": 4, "method": "tools/call",
"params": { "name": "get_reading", "arguments": { "kit": "kit.mail", "name": "unread" } } }
The result is {value, at, stale} and, when the reading is shown in the Kit tab, source and changedAt. stale: true means the last read failed (the window is closed, the app isn't running): value is then the last good one, or the reading's default.
A reading is read only while something uses it. Asking for one reads it once if nothing else does.
Gotchas #
A kit that is off, or a name the kit doesn't declare, answers
No reading “name” in kit.