@abgov/adsp-sdk-mcp-server 1.20.2 → 1.21.0

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.
Files changed (55) hide show
  1. package/README.md +5 -0
  2. package/assets/docs/platform/deployment.md +0 -1
  3. package/assets/docs/platform/getting-started.md +0 -1
  4. package/assets/docs/platform/operations.md +0 -1
  5. package/assets/docs/platform/platform-django-sdk.md +0 -1
  6. package/assets/docs/platform/platform-dotnet-sdk.md +0 -1
  7. package/assets/docs/platform/platform-flask-sdk.md +0 -1
  8. package/assets/docs/platform/platform-node-sdk.md +0 -1
  9. package/assets/docs/platform/platform-spring-sdk.md +0 -1
  10. package/assets/docs/services/access-service-backup-disaster-recovery.md +0 -1
  11. package/assets/docs/services/access-service.md +0 -1
  12. package/assets/docs/services/agent-service.md +0 -1
  13. package/assets/docs/services/cache-service.md +111 -24
  14. package/assets/docs/services/calendar-service.md +96 -18
  15. package/assets/docs/services/comment-service.md +179 -49
  16. package/assets/docs/services/configuration-service.md +0 -1
  17. package/assets/docs/services/directory-service.md +129 -16
  18. package/assets/docs/services/event-service.md +0 -1
  19. package/assets/docs/services/export-service.md +135 -0
  20. package/assets/docs/services/feedback-service.md +46 -10
  21. package/assets/docs/services/file-service.md +0 -1
  22. package/assets/docs/services/form-service.md +0 -1
  23. package/assets/docs/services/notification-service.md +0 -1
  24. package/assets/docs/services/pdf-service.md +113 -44
  25. package/assets/docs/services/pii-service.md +0 -1
  26. package/assets/docs/services/project-planner-service.md +215 -43
  27. package/assets/docs/services/push-service.md +159 -73
  28. package/assets/docs/services/status-service.md +0 -1
  29. package/assets/docs/services/task-service.md +262 -99
  30. package/assets/docs/services/tenant-service.md +113 -2
  31. package/assets/docs/services/token-handler.md +0 -1
  32. package/assets/docs/services/value-service.md +13 -1
  33. package/assets/docs/services/verify-service.md +60 -36
  34. package/assets/docs/tutorials/access-service/access-service.md +0 -1
  35. package/assets/docs/tutorials/feedback-service/feedback-service.md +0 -1
  36. package/assets/docs/tutorials/file-service/file-service.md +0 -1
  37. package/assets/docs/tutorials/form-service/form-service.md +0 -1
  38. package/assets/docs/tutorials/notification-service/notification-service.md +0 -1
  39. package/assets/docs/tutorials/pdf-service/building-a-template.md +2 -2
  40. package/assets/docs/tutorials/pdf-service/generate-a-pdf.md +17 -10
  41. package/assets/docs/tutorials/pdf-service/pdf-service.md +0 -1
  42. package/assets/docs/tutorials/status-service/status-service.md +0 -1
  43. package/assets/docs/tutorials/task-service/introduction.md +1 -1
  44. package/assets/docs/tutorials/task-service/task-definitions.md +1 -1
  45. package/assets/docs/tutorials/task-service/task-queues.md +13 -11
  46. package/assets/docs/tutorials/task-service/task-service.md +0 -1
  47. package/package.json +1 -1
  48. package/src/http.d.ts +10 -0
  49. package/src/http.js +105 -0
  50. package/src/http.js.map +1 -0
  51. package/src/main.js +4 -82
  52. package/src/main.js.map +1 -1
  53. package/src/server.d.ts +6 -0
  54. package/src/server.js +17 -6
  55. package/src/server.js.map +1 -1
package/README.md CHANGED
@@ -70,6 +70,11 @@ nx test adsp-sdk-mcp-server
70
70
  nx lint adsp-sdk-mcp-server
71
71
  ```
72
72
 
73
+ `src/fixtures/tool-contract.golden.json` is maintained by hand. It pins only the docs tools' and the unknown tool's
74
+ output over the fixture docs in `src/fixtures/docs`; the other tools are checked for equal output across transports
75
+ instead, so SDK reference and quickstart edits don't touch it. If you change docs search or the docs tools' output on
76
+ purpose, update the matching entry.
77
+
73
78
  To try it locally against a real MCP client, point the client config's `command`/`args` at the built entry point
74
79
  instead of `npx`:
75
80
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Platform deployment
4
- nav_order: 7
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Getting started
4
- nav_order: 1
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Operations
4
- nav_order: 7
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Service SDK (Django)
4
- nav_order: 6
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Service SDK (.NET)
4
- nav_order: 2
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Service SDK (Flask)
4
- nav_order: 5
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Service SDK (Node.js)
4
- nav_order: 3
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Service SDK (Spring)
4
- nav_order: 4
5
4
  parent: Platform development
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Access service backup and disaster recovery
4
- nav_order: 3
5
4
  parent: Services
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Access service
4
- nav_order: 2
5
4
  parent: Services
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Agent service
4
- nav_order: 21
5
4
  parent: Services
6
5
  ---
7
6
 
@@ -1,61 +1,148 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Cache service
4
- nav_order: 20
5
4
  parent: Services
6
5
  ---
7
6
 
8
7
  # Cache service
9
- Cache service provides a read-through cache to upstream *targets*. Unlike generic HTTP shared cache solutions, the cache service is integrated into the ADSP multi-tenant security layer and user context aware. This allows it to cache resources protected by role-based access control (RBAC) using user-specific cache entries.
8
+
9
+ Cache service provides a read-through cache to upstream _targets_. Unlike generic HTTP shared cache solutions, the cache service is integrated into the ADSP multi-tenant security layer and user context aware. This allows it to cache resources protected by role-based access control (RBAC) using user-specific cache entries.
10
10
 
11
11
  ## Client roles
12
+
12
13
  client `urn:ads:platform:cache-service`
13
14
 
14
- | name | description |
15
- |:-|:-|
15
+ | name | description |
16
+ | :----------- | :----------------------------------------------------------------------------- |
16
17
  | cache-reader | Reader role that allows a user to make requests through the cache service API. |
17
18
 
18
19
  Requests without a JWT bearer token in the `Authorization` header don't have any user context for cache service and associated responses are cached and shared across anonymous users. This is similar to regular HTTP shared caches.
19
20
 
20
- Requests with a JWT bearer token in the `Authorization` header are handled in the user context, the credential is passed through for the upstream request, and associated responses are cached in the user context (effectively including `sub`, `aud`, claims related to roles). This means that:
21
+ Requests with a JWT bearer token in the `Authorization` header are handled in the user context. The user needs the `cache-reader` role in the tenant (core users with the role are also allowed), the credential is passed through for the upstream request, and associated responses are cached in the user context (effectively including `sub`, `aud`, `scope`, and claims related to roles). A bearer token that fails validation (for example an expired token) is not rejected; the request is handled as an anonymous request. This means that:
22
+
21
23
  - Two users making the same request will not share a cache entry
22
24
  - One user authenticated in two contexts with different `aud` claim, such as from a limited public application and from a private application, making the same request will not share a cache entry between contexts.
23
25
  - One user with two different short-lived access tokens making the same request can share a cache entry if the cache entry did not expire between requests. This is because access token specific claims like `exp` are not included in the user context for caching.
24
26
 
27
+ ## Tenancy
28
+
29
+ - **Which tenant is used.** Tenant users and service accounts act on the tenant of their token. Core users set the tenant with the `tenantId` query parameter. Anonymous requests have no token, so they also set the tenant with `tenantId` (for example `?tenantId=urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7`). Without a tenant context the request is rejected with 400. The `tenantId` parameter is also forwarded to the upstream request with the rest of the query.
30
+ - **Targets.** Targets are read from the tenant's `platform:cache-service` configuration combined with the platform (core) configuration. When both define the same target, the platform configuration wins. The platform configuration includes the [access service](#access-target) target, so it is available in every tenant.
31
+ - **Isolation.** Cache entries are keyed on the tenant, so tenants never share entries. A target that isn't configured for the tenant responds 404. The upstream request is made with the caller's credential, so the upstream service applies its own tenant and role checks.
32
+
33
+ ## API overview
34
+
35
+ All endpoints are under `https://cache-service.adsp.alberta.ca/cache/v1`. See the [API documentation](https://api.adsp.alberta.ca) for parameters and responses.
36
+
37
+ | Endpoint | Purpose | Required role |
38
+ | :---------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------- |
39
+ | `GET /cache/v1/cache/{target}/{resource}` | Read a resource from an upstream target through the cache. `{resource}` is the path relative to the target's URL and can contain several segments. | `cache-reader` for requests with a bearer token; anonymous requests are allowed except for the access service target |
40
+
41
+ Responses from upstream, including their status code, are passed through with an `adsp-cache-status` header. Requests are rejected with 400 if there is no tenant context or the client doesn't accept `gzip`, 401 for anonymous requests to the access service target, 403 for users without the `cache-reader` role, and 404 if the target isn't configured.
42
+
43
+ Targets are configured through the [configuration service](configuration-service.md); cache service has no endpoints of its own for them.
44
+
45
+ ## Concepts
46
+
47
+ ### Target
48
+
49
+ Targets are upstream services and APIs that cache service can provide read-through requests to. This configuration is a whitelist that restricts the upstream resources available through the cache service API. Targets are configured as service or API URNs and must be registered in [directory service](directory-service.md). Each target can set a `ttl` in seconds and `invalidationEvents`, which name the domain events (`namespace` and `name`) and the `resourceIdPath` in the event payload of the resource URN to invalidate. Targets are configured in the [configuration service](configuration-service.md) under the `platform:cache-service` namespace and name.
50
+
51
+ ### Access target
52
+
53
+ Cache service includes a special target for the [access service](access-service.md) admin API at `urn:ads:platform:access-service:v1`. This target is pre-configured for read-through to the admin API, and includes specific invalidation logic based on admin events. Note invalidation requires that the `adsp-event-listener` must be enabled in the tenant realm so that admin events are signaled via the [event service](event-service.md).
54
+
55
+ Requests through the access target require a user context, and the resource path must start with the tenant's realm (for example `my-tenant/users`). Responses are cached for 30 days unless invalidated by an admin event.
25
56
 
26
57
  ## Limitations
58
+
27
59
  ### Cache context
60
+
28
61
  For each request, the cache service generically generates a cache key based on the request context including the request path, query, and user context. Matrix and custom header based parameters are not included.
29
62
 
30
- The cache user context only includes a subset of values from the request access token including `sub`, `aud`, and roles related claims based on the default roles mapper. This allows cache entries to be reused across different access tokens, different relying party clients `azp`, and if basic profile attributes like name and email change. However, this means that non-RBAC based permission schemes will not generally work correctly with user context cache entries.
63
+ The cache user context only includes a subset of values from the request access token including `sub`, `aud`, `scope`, and roles related claims based on the default roles mapper. This allows cache entries to be reused across different access tokens, different relying party clients `azp`, and if basic profile attributes like name and email change. However, this means that non-RBAC based permission schemes will not generally work correctly with user context cache entries.
31
64
 
32
65
  ### Cache invalidation
33
- Cache invalidation is supported using a configurable TTL and via invalidation events. The cache key is a digest of the request values and cache service does not generally understand the semantic meaning of values (e.g. if an element of the path is a unique identifier of a domain entity). However, the cache service includes the cache key in an invalidation context set, which unlike the cache key is based only on the tenant and request path. Domain events that include the URN of an affected resource can be used to invalidate the set associated with that resource path. Note that the resource URN must be resolvable by the [directory](directory-service.md).
66
+
67
+ Cache invalidation is supported using a configurable TTL (15 minutes by default) and via invalidation events. The cache key is a digest of the request values and cache service does not generally understand the semantic meaning of values (e.g. if an element of the path is a unique identifier of a domain entity). However, the cache service includes the cache key in an invalidation context set, which unlike the cache key is based only on the tenant and request path. Domain events that include the URN of an affected resource can be used to invalidate the set associated with that resource path. Note that the resource URN must be resolvable by the [directory](directory-service.md).
68
+
69
+ ### Cached responses
70
+
71
+ Upstream responses with an empty body, a body of 1 MB or more, or a status code in the 500s are passed through to the client but not cached. Upstream `401` responses are cached for only 30 seconds, since they can be caused by transient token validation issues. Only the `Content-Type`, `Content-Encoding`, `Content-Length`, `Cache-Control`, and `Content-Disposition` headers of the upstream response are returned.
34
72
 
35
73
  ### Client gzip support
74
+
36
75
  Cache service makes upstream requests with `Accept-Encoding` header value of `gzip` and will cache the response content in its compressed form if the upstream server supports `gzip`. It will not decompress the content for clients, and so it will reject requests where `Accept-Encoding` indicates client does not accept `gzip`.
37
76
 
38
- ## Concepts
39
- ### Target
40
- Targets are upstream services and APIs that cache service can provide read-through requests to. This configuration is a whitelist that restricts the upstream resources available through the cache service API. Targets are configured as service or API URNs and must be registered in [directory service](directory-service.md), and an associated TTL can be set. Targets are configured in the [configuration service](configuration-service.md) under the `platform:cache-service` namespace and name.
77
+ ## Events
41
78
 
42
- ### Access target
43
- Cache service includes a special target for the [access service](access-service.md) admin API at `urn:ads:platform:access-service:v1`. This target is pre-configured for read-through to the admin API, and includes specific invalidation logic based on admin events. Note invalidation requires that the `adsp-event-listener` must be enabled in the tenant realm so that admin events are signaled via the [event service](event-service.md).
79
+ Cache service does not send domain events.
80
+
81
+ It consumes domain events from the [event service](event-service.md) to invalidate cache entries: events matching a target's `invalidationEvents`, and access service admin events for the access target. Events that don't match a target are ignored.
44
82
 
45
83
  ## Code examples
84
+
85
+ ### Configure a target
86
+
87
+ Targets are configured using the [configuration service](configuration-service.md). Note that new configuration may take up to 15 mins to apply.
88
+
89
+ ```typescript
90
+ const configurationServiceUrl = 'https://configuration-service.adsp.alberta.ca';
91
+
92
+ const request = {
93
+ operation: 'UPDATE',
94
+ update: {
95
+ targets: {
96
+ 'urn:ads:platform:file-service:v1': {
97
+ ttl: 900,
98
+ invalidationEvents: [{ namespace: 'file-service', name: 'file-deleted', resourceIdPath: 'file.urn' }],
99
+ },
100
+ },
101
+ },
102
+ };
103
+
104
+ await fetch(`${configurationServiceUrl}/configuration/v2/configuration/platform/cache-service`, {
105
+ method: 'PATCH',
106
+ headers: {
107
+ Authorization: `Bearer ${accessToken}`,
108
+ 'Content-Type': 'application/json',
109
+ },
110
+ body: JSON.stringify(request),
111
+ });
112
+ ```
113
+
46
114
  ### Download file through cache
115
+
47
116
  ```typescript
48
- const fileApiId = 'urn:ads:platform:file-service:v1';
49
- const fileId = '52269261-45c0-434e-9467-a888f0bcb4b7';
50
- await fetch(
51
- `https://cache-service.adsp.alberta.ca/cache/v1/cache/${fileApiId}/files/${fileId}/download`,
52
- {
53
- method: 'GET',
54
- headers: {
55
- 'Authorization': `Bearer ${accessToken}`,
56
- }
57
- }
58
- );
117
+ const fileApiId = 'urn:ads:platform:file-service:v1';
118
+ const fileId = '52269261-45c0-434e-9467-a888f0bcb4b7';
119
+ const response = await fetch(
120
+ `https://cache-service.adsp.alberta.ca/cache/v1/cache/${fileApiId}/files/${fileId}/download`,
121
+ {
122
+ method: 'GET',
123
+ headers: {
124
+ Authorization: `Bearer ${accessToken}`,
125
+ },
126
+ },
127
+ );
128
+
129
+ const cacheStatus = response.headers.get('adsp-cache-status');
130
+ const content = await response.blob();
59
131
  ```
60
132
 
61
- The cache service will add an `adsp-cache-status` header to the response with possible values of `HIT` and `MISS` to indicate if the response was retrieved from cache.
133
+ The cache service adds an `adsp-cache-status` header to the response with possible values of `HIT` and `MISS` to indicate if the response was retrieved from cache.
134
+
135
+ ### Read anonymously through cache
136
+
137
+ Anonymous requests name the tenant with the `tenantId` query parameter. Their responses are cached and shared across anonymous users. In this example the file is of a file type that allows anonymous read.
138
+
139
+ ```typescript
140
+ const fileApiId = 'urn:ads:platform:file-service:v1';
141
+ const tenantId = 'urn:ads:platform:tenant-service:v2:/tenants/61f2e3a8c9b1d2e3f4a5b6c7';
142
+ const fileId = '52269261-45c0-434e-9467-a888f0bcb4b7';
143
+ const response = await fetch(
144
+ `https://cache-service.adsp.alberta.ca/cache/v1/cache/${fileApiId}/files/${fileId}?tenantId=${encodeURIComponent(tenantId)}`,
145
+ );
146
+
147
+ const { filename, size } = await response.json();
148
+ ```
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  layout: page
3
3
  title: Calendar service
4
- nav_order: 12
5
4
  parent: Services
6
5
  ---
7
6
 
@@ -19,11 +18,44 @@ client `urn:ads:platform:calendar-service`
19
18
 
20
19
  `calendar-admin` is a Keycloak client role. It is created under the `urn:ads:platform:calendar-service` client when a tenant realm is created, and tenant administrators have it through the `tenant-admin` composite role. If your realm does not include it (for example, the realm was created before calendar service was available), add it from the *Service roles* tab of Access service in tenant administration. See [Access management](../important-notes.md#access-management).
21
20
 
22
- Access to events is primarily controlled by each calendar's `readRoles` and `updateRoles`. Read roles grant access to private events and their attendees; update roles also grant permission to create, update, and delete events and attendees. `calendar-admin` grants both for all calendars.
21
+ Access to events is primarily controlled by each calendar's `readRoles` and `updateRoles`, which can be any roles of the tenant realm:
22
+
23
+ | Caller | Public events | Private events | Attendees | Create, update, and delete events and attendees |
24
+ |:-|:-|:-|:-|:-|
25
+ | Anonymous, users without a calendar role, and users of another tenant | Read | No | No | No |
26
+ | Users with one of the calendar's `readRoles` | Read | Read | Read | No |
27
+ | Users with one of the calendar's `updateRoles` | Read | Read | Read | Yes |
28
+ | Users with `calendar-admin` | Read | Read | Read | Yes |
29
+
30
+ A role grants access only in the user's own tenant. Core (platform) users with `calendar-admin` or one of the calendar's roles have the same access in any tenant. Callers without access to private events receive only public events from list and export requests, and `403` for a private event, for attendees, or for `includeAttendees=true`. Attendees are never public, even for public events.
31
+
32
+ ## Tenancy
33
+ Calendars, events, and attendees belong to one tenant. Dates are platform data, the same for every tenant.
34
+
35
+ - **Tenant users and service accounts** act on the tenant of their token.
36
+ - **Core (platform) users and service accounts** set the `tenantId` query parameter (for example, `?tenantId=urn:ads:platform:tenant-service:v2:/tenants/{id}`). Calendar definition changes, and requests for a specific calendar or its events, respond `400` when there is no tenant context.
37
+ - **Anonymous users and users of another tenant** can read the public events of a tenant's calendar by naming the tenant with the `tenant` query parameter (for example, `?tenant=service-delivery`). The `tenant` parameter can be used on every `/calendars/{name}` endpoint and replaces the tenant of the token or `tenantId`. A user's roles only apply in their own tenant, so a user of another tenant only receives public events. An unknown tenant name responds `400`.
38
+ - **Platform versus tenant calendars.** `GET /calendars` lists the tenant's calendars (`source: tenant`) and the platform's core calendars (`source: core`) separately. Anonymous requests, and core users without `tenantId`, only receive core calendars. Core calendars can be used by every tenant, and each tenant's events in a core calendar are separate. Tenants can't create a calendar with the name of a core calendar, and can't change or delete core calendars. If a tenant and a core calendar have the same name, the core calendar is used.
39
+ - **Isolation.** Event and attendee IDs from another tenant or calendar respond `404`.
40
+
41
+ ## API overview
42
+ All endpoints are under `https://calendar-service.adsp.alberta.ca/calendar/v1`. Requests without a bearer token are anonymous. See the [API documentation](https://api.adsp.alberta.ca) for request and response schemas.
43
+
44
+ | Area | Endpoints | Required role |
45
+ |:-|:-|:-|
46
+ | Dates | `GET /dates`, `GET /dates/{id}` | None (anonymous allowed) |
47
+ | Calendars | `GET /calendars`, `GET /calendars/{name}` | None (anonymous allowed) |
48
+ | | `POST /calendars`, `PUT /calendars/{name}`, `DELETE /calendars/{name}` | `calendar-admin` |
49
+ | Events | `GET /calendars/{name}/events`, `GET /calendars/{name}/events/{id}`, `GET /calendars/{name}/export` | None for public events. Private events and `includeAttendees` need `calendar-admin`, or one of the calendar's `readRoles` or `updateRoles` |
50
+ | | `POST /calendars/{name}/events`, `PATCH\|DELETE /calendars/{name}/events/{id}`, `DELETE /calendars/{name}/events/{id}/occurrences/{occurrence}` | `calendar-admin`, or one of the calendar's `updateRoles` |
51
+ | Attendees | `GET /calendars/{name}/events/{id}/attendees`, `GET /calendars/{name}/events/{id}/attendees/{attendeeId}` | `calendar-admin`, or one of the calendar's `readRoles` or `updateRoles` |
52
+ | | `POST /calendars/{name}/events/{id}/attendees`, `PUT\|DELETE /calendars/{name}/events/{id}/attendees/{attendeeId}` | `calendar-admin`, or one of the calendar's `updateRoles` |
53
+
54
+ Calendar definition changes (`POST`, `PUT`, and `DELETE /calendars`) respond `401` without a bearer token. Other endpoints accept anonymous requests and respond `403` when the caller doesn't have the role. Requests that list events or attendees, or change them, respond `404` if the calendar or event doesn't exist in the tenant.
23
55
 
24
56
  ## Concepts
25
57
  ### Dates
26
- Calendar service provides informational endpoints for Dates that includes information like which days are business days and which are holidays.
58
+ Calendar service provides informational endpoints for Dates that includes information like which days are business days and which are holidays. Each date has an ID in the format `yyyyMMdd` (for example, `20261111`).
27
59
 
28
60
  ### Calendar
29
61
  A calendar is a container for *events*. Each calendar has a name, display name, and description, which are publicly accessible, and the `readRoles` and `updateRoles` that control access to its events.
@@ -32,15 +64,7 @@ Calendar definitions are stored in the [configuration service](configuration-ser
32
64
  - `tenant` calendars are created and managed by the tenant using the calendar service API or the calendar service page in tenant administration.
33
65
  - `core` calendars are registered by platform services, such as the `form-intake` calendar of form service. Tenants can use core calendars but cannot change them; they are view-only in tenant administration.
34
66
 
35
- | Method | Path | Description | Required role |
36
- |:-|:-|:-|:-|
37
- | `GET` | `/calendar/v1/calendars` | Lists calendar definitions with their `source`. Anonymous requests only receive core calendars. | None |
38
- | `GET` | `/calendar/v1/calendars/{name}` | Retrieves a calendar. | None |
39
- | `POST` | `/calendar/v1/calendars` | Creates a tenant calendar. Returns 201 with the calendar. | `calendar-admin` |
40
- | `PUT` | `/calendar/v1/calendars/{name}` | Replaces a tenant calendar. Returns 200 with the calendar. | `calendar-admin` |
41
- | `DELETE` | `/calendar/v1/calendars/{name}` | Deletes a tenant calendar that has no events. Returns 204. | `calendar-admin` |
42
-
43
- `calendar-admin` is sufficient to manage tenant calendars; `configuration-admin` is not required. Anonymous requests for a specific calendar, including its public events, must identify the tenant by name using the `tenant` query parameter. Platform (core) users specify the tenant using the `tenantId` query parameter.
67
+ `calendar-admin` is sufficient to manage tenant calendars; `configuration-admin` is not required.
44
68
 
45
69
  Create and update requests take a body with the following properties; other properties are not allowed.
46
70
 
@@ -53,17 +77,19 @@ Create and update requests take a body with the following properties; other prop
53
77
  | `updateRoles` | yes | Roles that can read and change events and attendees. Can be an empty array. |
54
78
 
55
79
  Create, update, and delete requests return:
56
- - 400 if the request body or calendar name is invalid.
80
+ - 400 if the request body or calendar name is invalid, or there is no tenant context.
57
81
  - 401 if the request is not authenticated.
58
82
  - 403 if the user does not have the `calendar-admin` role in the tenant.
59
83
  - 404 on update or delete if the tenant has no calendar with that name. Core calendars cannot be updated or deleted.
60
84
  - 409 on create if a tenant or core calendar with the name already exists, or on delete if the calendar has events.
61
85
  - 502 if the configuration service is unavailable.
62
86
 
63
- Successful changes signal `calendar-definition-created`, `calendar-definition-updated`, and `calendar-definition-deleted` [domain events](event-service.md). Each event includes the calendar definition and the user who made the change.
64
-
65
87
  ### Calendar event
66
- Calendar events represent a scheduled activity. Each event has some basic name and description information as well as start and end time. Events can be made public so that anonymous users can read their fields; their attendees remain accessible only to authorized users.
88
+ Calendar events represent a scheduled activity. Each event has a name (up to 50 characters), an optional description, and a start and end time; `end` is required when creating an event and can't be before `start`. An event can also have a `recordId` to link it to a record in another system, and a `context` object of properties that can be used as criteria to find it.
89
+
90
+ Events are private unless `isPublic` is `true`. Anyone, including anonymous users, can read the fields of a public event. Private events are only returned to callers with one of the calendar's roles or `calendar-admin` (see [Client roles](#client-roles)).
91
+
92
+ Updates (`PATCH`) change only the properties in the request. `end`, `name`, `description`, and `context` can be changed but not cleared, and `recordId` can't be changed.
67
93
 
68
94
  ### Recurring event
69
95
  An event can optionally repeat by including a `recurrence`. The model is a subset of the iCalendar (RFC 5545) recurrence rule:
@@ -84,7 +110,21 @@ The event `start` and `end` are the first occurrence. Occurrences are generated
84
110
  - `DELETE /calendar/v1/calendars/{name}/events/{id}/occurrences/{date}` cancels one occurrence. Cancelled occurrences are listed in `recurrence.exclusions` of the event and can't be restored.
85
111
 
86
112
  ### Attendee
87
- Attendees represent people attending a particular *event*. Blank attendees (no name or email) can be created to represent available appointment slots.
113
+ Attendees represent people attending a particular *event*. Each attendee has a `name` and an `email`. The email is required and must be a valid email address; the name can be an empty string. Attendees are never public: reading them requires one of the calendar's roles or `calendar-admin`, even for public events.
114
+
115
+ ## Events
116
+ Calendar service sends these [domain events](event-service.md). It doesn't consume any events.
117
+
118
+ | Event | Sent when | Payload |
119
+ |:-|:-|:-|
120
+ | `calendar-definition-created` | A tenant calendar is created. | `calendar` definition and `createdBy` user. |
121
+ | `calendar-definition-updated` | A tenant calendar is updated. | `calendar` definition and `updatedBy` user. |
122
+ | `calendar-definition-deleted` | A tenant calendar is deleted. | `calendar` definition and `deletedBy` user. |
123
+ | `calendar-event-created` | An event is created. | `calendar`, `event`, and `createdBy` user. |
124
+ | `calendar-event-updated` | An event is updated, an occurrence is cancelled, or an attendee is added, set, or removed. | `calendar`, `event`, the `update` (with an `operation` of `add-attendee`, `set-attendee`, `delete-attendee`, or `exclude-occurrence` for those changes), and `updatedBy` user. |
125
+ | `calendar-event-deleted` | An event is deleted. | `calendar`, `event`, and `deletedBy` user. |
126
+
127
+ Event payloads include the fields of private events, and the `add-attendee` and `set-attendee` updates include the attendee's name and email. Anyone who can read the tenant's event log can see them.
88
128
 
89
129
  ## Code examples
90
130
  ### Getting business days
@@ -98,7 +138,7 @@ Calendar service API provides information endpoints for dates, including which d
98
138
  }
99
139
 
100
140
  const response = await fetch(
101
- `https://calendar-service.adsp.alberta.ca/calendar/v1/dates?top=${top}&criteria=${JSON.stringify(criteria)}`
141
+ `https://calendar-service.adsp.alberta.ca/calendar/v1/dates?top=${top}&criteria=${encodeURIComponent(JSON.stringify(criteria))}`
102
142
  );
103
143
 
104
144
  const {
@@ -139,6 +179,7 @@ Requires the `calendar-admin` role.
139
179
  ```
140
180
 
141
181
  ### Creating a calendar event
182
+ Requires `calendar-admin` or one of the calendar's `updateRoles`.
142
183
  ```typescript
143
184
  const calendarEvent = {
144
185
  name: 'My Event',
@@ -206,3 +247,40 @@ Requires the `calendar-admin` role.
206
247
  }
207
248
  );
208
249
  ```
250
+
251
+ ### Reading public events without signing in
252
+ Anonymous requests name the tenant with the `tenant` query parameter and only receive public events. The `from` and `to` range returns every event and occurrence in the range in one response.
253
+ ```typescript
254
+ const params = new URLSearchParams({
255
+ tenant: 'service-delivery',
256
+ from: '2026-10-01T00:00:00-06:00',
257
+ to: '2026-10-31T23:59:59-06:00',
258
+ });
259
+
260
+ const response = await fetch(
261
+ `https://calendar-service.adsp.alberta.ca/calendar/v1/calendars/${calendar}/events?${params}`
262
+ );
263
+
264
+ const { results } = await response.json();
265
+ for (const { id, recurrenceId, name, start, end } of results) {
266
+ // Occurrences of a recurring event share its id and have a recurrenceId.
267
+ }
268
+ ```
269
+
270
+ ### Adding an attendee to an event
271
+ Requires `calendar-admin` or one of the calendar's `updateRoles`.
272
+ ```typescript
273
+ const response = await fetch(
274
+ `https://calendar-service.adsp.alberta.ca/calendar/v1/calendars/${calendar}/events/${eventId}/attendees`,
275
+ {
276
+ method: 'POST',
277
+ headers: {
278
+ 'Authorization': `Bearer ${accessToken}`,
279
+ 'Content-Type': 'application/json',
280
+ },
281
+ body: JSON.stringify({ name: 'Test User', email: 'test.user@gov.ab.ca' }),
282
+ }
283
+ );
284
+
285
+ const { id, name, email } = await response.json();
286
+ ```