@abgov/adsp-sdk-mcp-server 1.24.0 → 1.24.1

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.
@@ -6,7 +6,7 @@ parent: Services
6
6
 
7
7
  # Value service
8
8
 
9
- Value service provides an append only time series data store. It serves as the underlying store for the event log.
9
+ Value service provides an append only time series data store. It serves as the underlying store for the event log: [event service](event-service.md) writes every logged domain event as a record of a value.
10
10
 
11
11
  ## Client roles
12
12
 
@@ -20,11 +20,53 @@ client `urn:ads:platform:value-service`
20
20
 
21
21
  The export service's `urn:ads:platform:export-service:export-job` role can also read values, so that export jobs can read the event log.
22
22
 
23
+ ## Tenancy
24
+
25
+ Values, metrics and value definitions belong to a tenant. Every record is stored with the tenant it was written to, and reads only return records of the tenant they act on.
26
+
27
+ - **Which tenant is used.** Tenant users and service accounts always act on the tenant of their token. Core (platform) users act on the tenant set by the `tenantId` query parameter; writes also accept `tenantId` in the body. An invalid `tenantId` responds 400.
28
+ - **Writing values.** Tenant users write to their own tenant; setting a `tenantId` for another tenant responds 403. Core users must set a tenant, otherwise the write responds 400. Event service writes the event log this way, as a core service account.
29
+ - **Reading records.** `GET /value/v1/{namespace}/values/{name}` responds 400 for a tenant user without a tenant context. Core users with `value-reader` can leave out `tenantId` to read the records of all tenants.
30
+ - **Counts and metrics.** Counting records and reading metrics require a tenant context, so core users must set `tenantId`; without it the request responds 400.
31
+ - **Platform metrics.** `GET /value/v1/{namespace}/values/{name}/platform-metrics` is the only endpoint that combines tenants in one response. It needs a core user with `value-platform-metrics-reader`, and labels each interval with its tenant.
32
+ - **Latest values of a namespace.** `GET /value/v1/{namespace}/values` acts on the tenant of the caller's token. Core users reading a tenant should read each value with `tenantId` instead.
33
+ - **Platform versus tenant definitions.** Value definitions come from the tenant's configuration and from core (platform) configuration. When reading a single definition, a tenant definition takes precedence over a core definition with the same namespace and name. Tenants can't change core definitions through this API, and can't create a definition whose namespace and name are already used by a core definition (409).
34
+ - **Isolation.** Records of other tenants are never returned, and definitions of other tenants respond 404.
35
+ - **Role scope.** Roles are checked in the tenant being acted on. Core users with the same role are also allowed.
36
+
37
+ ## API overview
38
+
39
+ All endpoints are under `https://value-service.adsp.alberta.ca/value/v1`. See the [API documentation](https://api.adsp.alberta.ca) for request and response schemas.
40
+
41
+ | Endpoint | Purpose | Required role |
42
+ | :--------------------------------------------------------- | :----------------------------------------------------------- | :------------------------------------------------ |
43
+ | `POST /value/v1/{namespace}/values/{name}` | Write one or more records of a value, with optional metrics. | `value-writer` |
44
+ | `GET /value/v1/{namespace}/values/{name}` | Read records of a value, newest first, with filters. | `value-reader`, or export service `export-job` |
45
+ | `GET /value/v1/{namespace}/values/{name}/count` | Count records of a value. | `value-reader` |
46
+ | `GET /value/v1/{namespace}/values` | Read the latest record of each defined value in a namespace. | `value-reader` |
47
+ | `GET /value/v1/{namespace}/values/{name}/metrics` | Read interval aggregates of a value's metrics. | `value-reader` |
48
+ | `GET /value/v1/{namespace}/values/{name}/metrics/{metric}` | Read interval aggregates of one metric. | `value-reader` |
49
+ | `GET /value/v1/{namespace}/values/{name}/platform-metrics` | Read a value's metrics across all tenants. | `value-platform-metrics-reader` (core users only) |
50
+ | `POST /value/v1/service-metric-rollups/run` | Run the service metric rollup for completed days. | `value-writer` |
51
+ | `GET /value/v1/definitions` | List tenant and core value definitions. | `value-reader` or `value-writer` |
52
+ | `POST /value/v1/definitions` | Create a tenant value definition. | `value-writer` |
53
+ | `GET /value/v1/definitions/{namespace}/{name}` | Get a value definition (tenant, otherwise core). | `value-reader` or `value-writer` |
54
+ | `PATCH /value/v1/definitions/{namespace}/{name}` | Update a tenant value definition. | `value-writer` |
55
+ | `DELETE /value/v1/definitions/{namespace}/{name}` | Delete a tenant value definition. | `value-writer` |
56
+
57
+ The event log has no endpoints of its own in value service. Event log consumers should use the [event service](event-service.md) API, which reads and counts the event log value for them.
58
+
23
59
  ## Concepts
24
60
 
61
+ ### Value
62
+
63
+ A value represents a particular time series stream, identified by a namespace and name (for example `support` and `application-stats`). Each write results in a new record with a timestamp. It differs from a typical transactional record in that the record has no unique identity; instead it represents another entry in the set of entries for the value. Consumers can write scalars or json objects to values.
64
+
65
+ A record has a `timestamp` (the time of the write unless set), an optional `correlationId` that links related records, an optional `context` object used to filter reads, and the `value` itself. Writing does not require a value definition. A write can be a full record, a bare JSON object that is written as the value, or an array of either.
66
+
25
67
  ### Value definition
26
68
 
27
- Value definition is an optional metadata description for a particular _value_ (identified by a specific namespace and name). The definition provides write-time validation via json schema, and can enable a `value-written` event on each write with `sendWriteEvent`.
69
+ Value definition is an optional metadata description for a particular _value_ (identified by a specific namespace and name). The definition provides write-time validation via json schema, and can enable a `value-written` event on each write with `sendWriteEvent`. Records that fail validation are skipped, and the rest of the write goes ahead. Only values with a definition are returned when reading the latest values of a namespace.
28
70
 
29
71
  Value definitions are managed through the value service definitions API (`/value/v1/definitions`). The value service checks the user's roles and then stores the definitions in the [configuration service](configuration-service.md) under the `platform:value-service` namespace and name, using its own service account. Clients do not need configuration service roles to manage value definitions.
30
72
 
@@ -34,23 +76,23 @@ Value definitions are managed through the value service definitions API (`/value
34
76
  - Creating a definition adds its namespace if it does not exist, and fails with a 409 if a tenant or core definition with the same namespace and name already exists.
35
77
  - Deleting the last definition in a namespace removes the namespace.
36
78
 
79
+ ### Event log
80
+
81
+ The event log is a value written by [event service](event-service.md): every logged domain event is written as a record of the `event` value in the `event-service` namespace (`/value/v1/event-service/values/event`), to the tenant of the event. The record's `context` holds the event's context plus its `namespace`, `name` and `trace`, and its `value` is `{ payload }`. Event service also writes metrics with each record: `total:count`, `{namespace}:{name}:count`, and, for event definitions with an interval, a `:duration` metric in seconds since the event that started the interval.
82
+
37
83
  > Counting events in the event log is exposed by the [event service](event-service.md#count-events-in-the-event-log).
38
84
  > Consumers of the event log count should use that API rather than calling value service directly.
39
85
 
40
- Event log reads support exact payload searching with either `payloadPath` and `payloadValue`, or a JSON object in
86
+ Reads of the event log support exact payload searching with either `payloadPath` and `payloadValue`, or a JSON object in
41
87
  `payload`. Both `timestampMin` and `timestampMax` are required for payload searches, and the two search forms are
42
88
  mutually exclusive. Every property in a multi-condition `payload` object must match (`AND`). See
43
89
  [Search the event log](event-service.md#search-the-event-log) for examples and scalar type handling.
44
90
 
45
- ### Value
46
-
47
- A value represents a particular time series stream. Each write results in a new record with a timestamp. It differs from a typical transactional record in that the record has no unique identity; instead it represents another entry in the set of entries for the value. Consumers can write scalars or json objects to values.
48
-
49
91
  ### Metrics
50
92
 
51
- Metrics are numeric values that can be included in value writes as a `metrics` object of metric name to number. They are aggregated into time intervals (`one_minute`, `five_minutes`, `hourly`, `daily`, `weekly` and `monthly`) with `sum`, `avg`, `min`, `max` and `count` for each interval, and can be used for basic KPIs.
93
+ Metrics are numeric values that can be included in value writes as a `metrics` object of metric name to number; non-numeric entries are ignored, and metrics are not returned with the record. For a value with a definition, a `metrics` property inside the written `value` object is also moved into the record's metrics. Metrics are aggregated into time intervals (`one_minute`, `five_minutes`, `hourly`, `daily`, `weekly` and `monthly`) with `sum`, `avg`, `min`, `max` and `count` for each interval, and can be used for basic KPIs.
52
94
 
53
- Read a value's metrics from `/value/v1/{namespace}/values/{name}/metrics`, or a single metric from `/value/v1/{namespace}/values/{name}/metrics/{metric}`. The `interval` defaults to `daily`, and the JSON `criteria` accepts `intervalMin`, `intervalMax` and (for all metrics) `metricLike`. Without a range, the last month is read.
95
+ Read a value's metrics from `/value/v1/{namespace}/values/{name}/metrics`, or a single metric from `/value/v1/{namespace}/values/{name}/metrics/{metric}`. The `interval` defaults to `daily`; any value other than the six intervals responds 400. The `criteria` query parameter is a JSON object that accepts `intervalMin`, `intervalMax` and (for all metrics) `metricLike`, and must be valid JSON. Without a range, the last month is read. Results are newest first and paged `top` interval rows at a time (default 100, maximum 5000); pass `page.next` back as `after` for the next page.
54
96
 
55
97
  Core users with the `value-platform-metrics-reader` role can read a value's metrics across all tenants, labelled by tenant, from `/value/v1/{namespace}/values/{name}/platform-metrics`. This only reads the materialised rollups described below and is not paginated.
56
98
 
@@ -92,6 +134,16 @@ The job is off by default. Set `SERVICE_METRIC_ROLLUP_JOB_ENABLED=true` to run i
92
134
 
93
135
  A rollup can also be run on demand with `POST /value/v1/service-metric-rollups/run` and the `value-writer` role. The body can set `start` and `end` dates, which default to the trailing days. Core users can set `tenantId` or leave it out to roll up all tenants; tenant users always roll up their own tenant. The current partial day and future days are rejected.
94
136
 
137
+ ## Events
138
+
139
+ Value service sends one domain event:
140
+
141
+ | Event | Sent when |
142
+ | :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
143
+ | `value-written` | A record is written to a value whose definition has `sendWriteEvent` set. The payload has `timestamp`, `value` and `writtenBy`, and the context has the record's context plus `namespace` and `name`. |
144
+
145
+ `value-written` events are not written to the event log. Value service doesn't consume domain events; event service writes the event log by calling the value service API, not through an event subscription.
146
+
95
147
  ## Audit
96
148
 
97
149
  Value service records audit events for administrative changes through the [audit service](audit-service.md), under the `value-service` namespace. Each record includes the actor and the affected resource. Actions do not set a retention class; the audit service derives it from the category (`compliance` for administrative and data-access actions, `standard` for runtime actions), as shown in the table.
@@ -153,6 +205,39 @@ const { page, ...result } = await response.json();
153
205
  const records = result[namespace][name];
154
206
  ```
155
207
 
208
+ ### Read the latest values of a namespace
209
+
210
+ ```typescript
211
+ const namespace = 'support';
212
+ const response = await fetch(
213
+ `https://value-service.adsp.alberta.ca/value/v1/${namespace}/values?names=application-stats`,
214
+ {
215
+ method: 'GET',
216
+ headers: { Authorization: `Bearer ${accessToken}` },
217
+ },
218
+ );
219
+
220
+ // Keyed by namespace, then name; each is the latest record.
221
+ const { [namespace]: latest } = await response.json();
222
+ const { timestamp, value } = latest['application-stats'];
223
+ ```
224
+
225
+ ### Count records
226
+
227
+ ```typescript
228
+ const namespace = 'support';
229
+ const name = 'application-stats';
230
+ const response = await fetch(
231
+ `https://value-service.adsp.alberta.ca/value/v1/${namespace}/values/${name}/count?timestampMin=2026-09-01T00:00:00Z`,
232
+ {
233
+ method: 'GET',
234
+ headers: { Authorization: `Bearer ${accessToken}` },
235
+ },
236
+ );
237
+
238
+ const { count } = await response.json();
239
+ ```
240
+
156
241
  ### Read metrics
157
242
 
158
243
  ```typescript
@@ -168,6 +253,7 @@ const response = await fetch(
168
253
  );
169
254
 
170
255
  // Keyed by metric name; each has values of { interval, sum, avg, min, max, count }, newest first.
256
+ // page.intervalMax is the end of the window actually read.
171
257
  const { page, ...metrics } = await response.json();
172
258
  ```
173
259
 
@@ -262,7 +262,7 @@ For additional examples and option reference material, see the [cheat sheet](/ad
262
262
  ADSP has added several enhancements to the form builder in order to help designers and developers create professional looking forms. These include:
263
263
 
264
264
  - Adding [text, images, and links](/adsp-monorepo/tutorials/form-service/instructions.html) to forms in order to help clarify the information that is needed from end-users when filling them out.
265
- - A [file upload widget](/adsp-monorepo/tutorials/form-service/file-uploader.md)
265
+ - A [file upload widget](/adsp-monorepo/tutorials/form-service/file-uploader.html)
266
266
  - Data registries
267
267
 
268
268
  ## Learn More
@@ -1264,7 +1264,7 @@ As of **Jan. 2025** you can use markdown for help content, significantly simplif
1264
1264
 
1265
1265
  ### File Uploads {#target-uploads}
1266
1266
 
1267
- For when the user needs to upload supporting documentation. For a more complete description of file uploads, see [the documentation](/adsp-monorepo/tutorials/form-service/file-uploader.md).
1267
+ For when the user needs to upload supporting documentation. For a more complete description of file uploads, see [the documentation](/adsp-monorepo/tutorials/form-service/file-uploader.html).
1268
1268
 
1269
1269
  <table>
1270
1270
  <tr>
@@ -26,7 +26,7 @@ However, you can also configure a form to allow anonymous access. Anyone will be
26
26
 
27
27
  ### Security
28
28
 
29
- Developers can define the roles that are required to create, review and disposition their forms, as described in the [security section](/adsp-monorepo/tutorials/task-service/security.html) of the tutorial. In addition, they will need the ADSP-specific roles for accessing a form. The former should be specific to your _Tenant_ and _Form Definition_, as they will lock down access so that only your users can log-in and fill in the information. For the _Form App_, a user will need to be an _applicant_. _Clerks_ and _assessors_ will be able to review and disposition this forms through the [Task App](/adsp-monorepo/tutorials/task-service/task-app.html).
29
+ Developers can define the roles that are required to create, review and disposition their forms, as described in the [security section](/adsp-monorepo/tutorials/form-service/security.html) of the tutorial. In addition, they will need the ADSP-specific roles for accessing a form. The former should be specific to your _Tenant_ and _Form Definition_, as they will lock down access so that only your users can log-in and fill in the information. For the _Form App_, a user will need to be an _applicant_. _Clerks_ and _assessors_ will be able to review and disposition this forms through the [Task App](/adsp-monorepo/tutorials/task-service/task-app.html).
30
30
 
31
31
  #### Client Security
32
32
 
@@ -34,7 +34,7 @@ _Submission records_ can be used to help manage _Form Disposition_; that is, the
34
34
 
35
35
  ### Submission Queues
36
36
 
37
- In addition, developers can also opt-in to have the submission record placed in a [Task Queue](/adsp-monorepo/tutorials/task-service.html) for further processing:
37
+ In addition, developers can also opt-in to have the submission record placed in a [Task Queue](/adsp-monorepo/tutorials/task-service/task-queues.html) for further processing:
38
38
 
39
39
  ![](/adsp-monorepo/assets/form-service/submissionQueue.png){: width="400" }
40
40
 
@@ -18,7 +18,7 @@ Jsonforms provides a declarative means for creating new form definitions. Develo
18
18
 
19
19
  ### Rendering
20
20
 
21
- Currently the Form Service only supports rendering forms in React applications through a Jsonforms React component. [Adding it to your application](/adsp-monorepo/tutorials/form-service/integration.html) enables it to:
21
+ Currently the Form Service only supports rendering forms in React applications through a Jsonforms React component. [Adding it to your application](/adsp-monorepo/tutorials/form-service/Integration.html) enables it to:
22
22
 
23
23
  - render the form,
24
24
  - secure access to it,
@@ -28,7 +28,7 @@ There are several roles that may be required for users to access the form servic
28
28
 
29
29
  ![](/adsp-monorepo/assets/form-service/form-service-roles.png){: width="600" }
30
30
 
31
- Applicants will need the _form-admin_ and _intake-application_ role to create and fill out forms, respectively. If the form requires files to be uploaded they will also need:
31
+ Applicants create and fill out forms with the applicant roles of the _Form Definition_, and need the _form-applicant_ role to receive updates in the form app. The _form-admin_ role is for form administrators, and the _intake-application_ role is for service accounts that create and submit forms on behalf of anonymous applicants. If the form requires files to be uploaded applicants will also need:
32
32
 
33
33
  - _form-file-reader_
34
34
  - _form-file-uploader_
@@ -40,7 +40,7 @@ Click _start health check_ to begin the pinging. The status bar will update ever
40
40
 
41
41
  ### APIs
42
42
 
43
- You can also monitor and control the pings via the [Status Service APIs](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Status%20service), from another application. This would only be necessary if you wished to automate control, provide your own interface to keep user's notified, or perhaps to perform automated diagnostic on the application in question. The [Tenant Management Webapp](https://adsp.alberta.ca) provides basic capabilities for doing these things manually.
43
+ You can also monitor and control the pings via the [Status Service APIs](https://api.adsp.alberta.ca), from another application. This would only be necessary if you wished to automate control, provide your own interface to keep user's notified, or perhaps to perform automated diagnostic on the application in question. The [Tenant Management Webapp](https://adsp.alberta.ca) provides basic capabilities for doing these things manually.
44
44
 
45
45
  ## Learn More
46
46
 
@@ -8,7 +8,7 @@ grand_parent: Tutorials
8
8
 
9
9
  ## Application Status
10
10
 
11
- Application status is the _operational status_ of your application that can be set manually through the Status Service page on the [Tenant Admin Webapp](https://adsp.alberta.ca) or automatically, by integrating the [status service APIs](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Status%20service) with your application. Operational status can take on one of four values:
11
+ Application status is the _operational status_ of your application that can be set manually through the Status Service page on the [Tenant Admin Webapp](https://adsp.alberta.ca) or automatically, by integrating the [status service APIs](https://api.adsp.alberta.ca) with your application. Operational status can take on one of four values:
12
12
 
13
13
  - Operational: The application is up and running,
14
14
  - Maintenance: The application is undergoing routine maintenance,
@@ -26,7 +26,7 @@ Changing an application's status can affect users in a couple of ways. It will
26
26
  - update the status on the public static webpage provided for your tenant, and
27
27
  - notify anyone who has subscribed for notification of change. This includes end users.
28
28
 
29
- The public status page for your tenant can be found at at https://status.adsp.alberta.ca/{tenant-name}. Linking to this will give your users information about your tenant applications, including any [notices](/adsp-monorepo/tutorials/status-service/notifications.html) you may have posted. The latter gives you the ability to post information about a status change, including expected times. This is useful, for example, to inform users of upcoming maintenance windows or current outages.
29
+ The public status page for your tenant can be found at at https://status.adsp.alberta.ca/{tenant-name}. Linking to this will give your users information about your tenant applications, including any [notices](/adsp-monorepo/tutorials/status-service/notices.html) you may have posted. The latter gives you the ability to post information about a status change, including expected times. This is useful, for example, to inform users of upcoming maintenance windows or current outages.
30
30
 
31
31
  ## Learn More
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/adsp-sdk-mcp-server",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - MCP server for ADSP documentation and Node SDK reference lookup.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",