@protobase/cli 0.53.1 → 0.53.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.53.1";
2
+ var version = "0.53.2";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.53.1",
3
+ "version": "0.53.2",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,12 +42,12 @@
42
42
  "dependencies": {
43
43
  "@better-auth/core": "^1.7.12",
44
44
  "@hono/node-server": "^2.1.3",
45
- "@protobase/config": "0.53.1",
46
- "@protobase/layout": "0.53.1",
47
- "@protobase/query": "0.53.1",
48
- "@protobase/schema": "0.53.1",
49
- "@protobase/server": "0.53.1",
50
- "@protobase/ui": "0.53.1",
45
+ "@protobase/config": "0.53.2",
46
+ "@protobase/layout": "0.53.2",
47
+ "@protobase/query": "0.53.2",
48
+ "@protobase/schema": "0.53.2",
49
+ "@protobase/server": "0.53.2",
50
+ "@protobase/ui": "0.53.2",
51
51
  "@react-email/render": "^2.1.0",
52
52
  "@scalar/hono-api-reference": "^0.12.10",
53
53
  "@tailwindcss/vite": "^4.3.3",
@@ -10,6 +10,7 @@ Fields and actions filled by a model, the assistant beside the admin, and MCP.
10
10
  - [Choice of model](../reference/assistant.md#which-backend): The assistant runs on OpenRouter or any OpenAI-compatible endpoint, also a local one.
11
11
  - [Assistant tools](../reference/assistant.md#the-apps-own-tools): Your own tools for the assistant, acting on records as the user.
12
12
  - [MCP server](../reference/mcp.md#the-tools): AI clients connect to the app over MCP as the signed-in person: they list the resources in a small first call, describe one resource's fields when they need them, and find and read records within that person's access, soft-deleted ones too when asked.
13
+ - [MCP read fields](../reference/mcp.md#reading-only-what-is-needed): AI clients read only the fields they name, a plain list returns the columns of the app's table, and the server tells clients how to keep reads small.
13
14
  - [MCP counts](../reference/mcp.md#the-tools): AI clients count the records a filter finds, in all or per value of a field such as a status, without reading the records.
14
15
  - [MCP app icon](../reference/mcp.md#the-apps-icon): AI clients show the app's own icon beside its name when someone adds its MCP endpoint.
15
16
  - [MCP writes](../reference/mcp.md#writes): When turned on, for every resource or only those you list, AI clients create, update and delete records after the person approves each write.
@@ -42,14 +42,30 @@ Each tool reads as the signed-in person: their role's access rules, row filters,
42
42
  | Tool | What it does |
43
43
  | --- | --- |
44
44
  | `list_resources` | The resources the person may read, kept small for a client's first call: each one's name, label, the first line of its help, key and whether it soft deletes (`soft_delete`), without its fields. |
45
- | `describe_resource` | One resource the person may read, with its fields: each field's type, label, help, enum values, the resource a relation links to, and whether it is optional, read-only and taken by filters and sorts. |
46
- | `list_records` | A page of a resource's records: `filter` in the API's [filter syntax](api.md#filters), `order_by`, `page_size` (20 by default, at most 100) and `page_token`, with `next_page_token` for the next page. `show_deleted: true` also returns soft-deleted records. |
45
+ | `describe_resource` | One resource the person may read, with its fields: each field's type, label, help, enum values, the resource a relation links to, and whether it is optional, read-only and taken by filters and sorts. It also names the resource's `list_fields`, what `list_records` returns when not told which. |
46
+ | `list_records` | A page of a resource's records: `fields`, `filter` in the API's [filter syntax](api.md#filters), `order_by`, `page_size` (20 by default, at most 100) and `page_token`, with `next_page_token` for the next page and `total_size_estimate`, an estimate rather than an exact count. `show_deleted: true` also returns soft-deleted records. |
47
47
  | `count_records` | How many records a `filter` finds, without returning them: `{ count }` as the API's `count=exact` counts, or `{ more_than: 10000, estimate }` when more match. With `group_by`, a filterable field, the count per value instead, as [`:aggregate`](api.md#routes) gives it: `{ group_by, groups: [{ value, count }] }`, largest first, adding up to what the filter finds, the first `limit` (100 by default, at most 1,000), with `label` naming a relation's values by a field of the records they link to. A date or timestamp `group_by` counts per day over the last 30 days. `show_deleted: true` also counts soft-deleted records. |
48
- | `get_record` | One record by its key, with its ETag. A composite key is passed as the values of its fields, in order. `show_deleted: true` also finds a soft-deleted record. |
48
+ | `get_record` | One record by its key, with its ETag, holding the `fields` asked for or, without them, every field. A composite key is passed as the values of its fields, in order. `show_deleted: true` also finds a soft-deleted record. |
49
49
 
50
50
  `show_deleted` works as the [REST API](api.md#routes)'s: it applies only to a resource with a soft delete, and is refused on any other. <gap>`count_records` cannot count soft-deleted records per value because `:aggregate` does not implement `show_deleted`.</gap> Soft-deleted records come under the same access rules, tenant and hidden fields as the rest, and carry the field their deletion set.
51
51
 
52
- A refusal, such as a resource the person may not read or a bad filter, comes back to the client as text it can act on, `{ "error": ..., "message": ... }`.
52
+ ### Reading only what is needed
53
+
54
+ Records can hold long texts, such as a description or notes, and a page of them can run past what a client can take in. So `list_records` and `get_record` take `fields`, the field names to return, as an [AIP-157](https://google.aip.dev/157) read mask does, with `["*"]` for every field.
55
+
56
+ Without `fields`, `list_records` returns the record's key and the columns of the resource's table in the app: the list's `columns` of the person's view, or its first six fields when the view has no list. `describe_resource` names them as the resource's `list_fields`, and the page names the fields it left out in `omitted_fields`. `get_record` returns every field unless told which.
57
+
58
+ The server tells each client this when it connects, in its instructions, and the tool descriptions repeat it: name the fields needed, filter on the fields marked filterable, which are indexed, rather than paging through records to search them, and keep pages small. For example, the open tasks, newest first, ten at a time, then the brief of one of them:
59
+
60
+ ```json
61
+ { "resource": "tasks", "fields": ["id", "status", "title"], "filter": "status = \"open\"", "order_by": "created_at desc", "page_size": 10 }
62
+ ```
63
+
64
+ ```json
65
+ { "resource": "tasks", "key": "42", "fields": ["brief"] }
66
+ ```
67
+
68
+ A refusal, such as a resource the person may not read, a bad filter or a field the person may not read, comes back to the client as text it can act on, `{ "error": ..., "message": ... }`.
53
69
 
54
70
  ### Comments
55
71
 
@@ -155,7 +171,7 @@ The endpoint serves each request on its own, without an MCP session: a `GET` or
155
171
  `@protobase/server` exports the pieces the endpoint is made of, for an MCP server of your own with tools of your own:
156
172
 
157
173
  - `mcpHandler({ authenticate, resource, scope, server })`: the endpoint as a fetch handler. It checks the host, admits a valid token (`mcpGate`) and serves the request with the server that `server(session, request)` builds for its caller; `request` is the HTTP request, such as for the language the person reads.
158
- - `mcpServer({ info, tools, context, report, rolesWithoutApproval, approvals })`: an MCP server named by `info`, its `name`, `version` and `icons`, such as `mcpIcons(origin, icons)`, the app's icons on `origin`, and offering [assistant tools](assistant.md#the-apps-own-tools), each with its JSON Schema and its `annotations`, MCP's tool hints. `context` is the tools' context without `approve`, with the `locale` its approvals are asked in (English when absent): each call gets its own, which asks the client's user, or approves at once when the session's user holds one of `rolesWithoutApproval`. `approvals` is `mcpApprovals()`, built once and passed to every server the endpoint builds: it keeps the approvals asked for until they are answered or expire.
174
+ - `mcpServer({ info, instructions, tools, context, report, rolesWithoutApproval, approvals })`: an MCP server named by `info`, its `name`, `version` and `icons`, such as `mcpIcons(origin, icons)`, the app's icons on `origin`, and offering [assistant tools](assistant.md#the-apps-own-tools), each with its JSON Schema and its `annotations`, MCP's tool hints. `context` is the tools' context without `approve`, with the `locale` its approvals are asked in (English when absent): each call gets its own, which asks the client's user, or approves at once when the session's user holds one of `rolesWithoutApproval`. `approvals` is `mcpApprovals()`, built once and passed to every server the endpoint builds: it keeps the approvals asked for until they are answered or expire. `instructions` is what it tells clients when they connect, by default `mcpInstructions`, the advice on reading records above.
159
175
  - `mcpTools({ db, sql, writes, commented })`: the default tools for a session; `writes` is `true`, `false` or `{ resources, rolesWithoutApproval }`, and `commented` names the resources with comments.
160
176
  - `readRecordTools()`, or `listResourcesTool()`, `describeResourceTool()`, `listRecordsTool()` and `getRecordTool()`: the read tools alone; `readOnlyQueryTool(db)` is `run_read_only_query`, and `readWriteQueryTool(db)` proposes one write statement that the user approves before it runs.
161
177
  - `commentTools({ commented }, writes)`, or `listCommentsTool({ commented })` and `addCommentTool({ commented, resources })`: the comment tools on the resources named in `commented`, which call the context's `comments`, and `add_comment` only when `writes` is not `false`.