@ebitex/mcp 0.0.0-stage → 1.1.313

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 (79) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +143 -2
  3. package/dist/app.d.ts +57 -0
  4. package/dist/app.d.ts.map +1 -0
  5. package/dist/app.js +8 -0
  6. package/dist/app.js.map +1 -0
  7. package/dist/apps/content/app.d.ts +23 -0
  8. package/dist/apps/content/app.d.ts.map +1 -0
  9. package/dist/apps/content/app.js +95 -0
  10. package/dist/apps/content/app.js.map +1 -0
  11. package/dist/apps/content/client.d.ts +34 -0
  12. package/dist/apps/content/client.d.ts.map +1 -0
  13. package/dist/apps/content/client.js +68 -0
  14. package/dist/apps/content/client.js.map +1 -0
  15. package/dist/apps/content/config.d.ts +29 -0
  16. package/dist/apps/content/config.d.ts.map +1 -0
  17. package/dist/apps/content/config.js +30 -0
  18. package/dist/apps/content/config.js.map +1 -0
  19. package/dist/apps/content/errors.d.ts +59 -0
  20. package/dist/apps/content/errors.d.ts.map +1 -0
  21. package/dist/apps/content/errors.js +122 -0
  22. package/dist/apps/content/errors.js.map +1 -0
  23. package/dist/apps/content/resources/helpCorpus.generated.d.ts +7 -0
  24. package/dist/apps/content/resources/helpCorpus.generated.d.ts.map +1 -0
  25. package/dist/apps/content/resources/helpCorpus.generated.js +162 -0
  26. package/dist/apps/content/resources/helpCorpus.generated.js.map +1 -0
  27. package/dist/apps/content/resources/register.d.ts +8 -0
  28. package/dist/apps/content/resources/register.d.ts.map +1 -0
  29. package/dist/apps/content/resources/register.js +81 -0
  30. package/dist/apps/content/resources/register.js.map +1 -0
  31. package/dist/apps/content/routes.d.ts +67 -0
  32. package/dist/apps/content/routes.d.ts.map +1 -0
  33. package/dist/apps/content/routes.js +163 -0
  34. package/dist/apps/content/routes.js.map +1 -0
  35. package/dist/apps/content/session.d.ts +60 -0
  36. package/dist/apps/content/session.d.ts.map +1 -0
  37. package/dist/apps/content/session.js +81 -0
  38. package/dist/apps/content/session.js.map +1 -0
  39. package/dist/apps/content/tools/catalog.d.ts +58 -0
  40. package/dist/apps/content/tools/catalog.d.ts.map +1 -0
  41. package/dist/apps/content/tools/catalog.js +81 -0
  42. package/dist/apps/content/tools/catalog.js.map +1 -0
  43. package/dist/apps/content/tools/cursor.d.ts +62 -0
  44. package/dist/apps/content/tools/cursor.d.ts.map +1 -0
  45. package/dist/apps/content/tools/cursor.js +94 -0
  46. package/dist/apps/content/tools/cursor.js.map +1 -0
  47. package/dist/apps/content/tools/register.d.ts +36 -0
  48. package/dist/apps/content/tools/register.d.ts.map +1 -0
  49. package/dist/apps/content/tools/register.js +470 -0
  50. package/dist/apps/content/tools/register.js.map +1 -0
  51. package/dist/apps/content/tools/result.d.ts +28 -0
  52. package/dist/apps/content/tools/result.d.ts.map +1 -0
  53. package/dist/apps/content/tools/result.js +26 -0
  54. package/dist/apps/content/tools/result.js.map +1 -0
  55. package/dist/apps/content/tools/whoami.d.ts +36 -0
  56. package/dist/apps/content/tools/whoami.d.ts.map +1 -0
  57. package/dist/apps/content/tools/whoami.js +39 -0
  58. package/dist/apps/content/tools/whoami.js.map +1 -0
  59. package/dist/apps/index.d.ts +8 -0
  60. package/dist/apps/index.d.ts.map +1 -0
  61. package/dist/apps/index.js +8 -0
  62. package/dist/apps/index.js.map +1 -0
  63. package/dist/config.d.ts +46 -0
  64. package/dist/config.d.ts.map +1 -0
  65. package/dist/config.js +69 -0
  66. package/dist/config.js.map +1 -0
  67. package/dist/index.d.ts +19 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +20 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/main.d.ts +3 -0
  72. package/dist/main.d.ts.map +1 -0
  73. package/dist/main.js +51 -0
  74. package/dist/main.js.map +1 -0
  75. package/dist/server.d.ts +51 -0
  76. package/dist/server.d.ts.map +1 -0
  77. package/dist/server.js +104 -0
  78. package/dist/server.js.map +1 -0
  79. package/package.json +44 -4
@@ -0,0 +1,81 @@
1
+ import { WRITABLE_KINDS } from '../routes.js';
2
+ import { SCOPE_AUTHORING, SCOPE_PUBLISH, SCOPE_READ } from '../session.js';
3
+ /**
4
+ * The content-mcp ↔ Platform.Api tool contract.
5
+ *
6
+ * This is the one place that states which scope gates each of the ten tools and which are
7
+ * read-only. `register.ts` reads from it rather than restating the mapping in its own `if` blocks
8
+ * and `withheld[]` construction, which is what makes this a single source rather than a second,
9
+ * hand-kept copy of the same fact.
10
+ *
11
+ * Held in step with `Platform.Api.ContentManagement.ManagementToolCatalog` by
12
+ * `src/test/tool-catalogue.json` (at the package root), asserted from both sides — the same pattern
13
+ * `transfer-identity-modes.json` already uses for one field's enum, generalized here to the whole
14
+ * tool surface.
15
+ */
16
+ /**
17
+ * The sentinel for `content_whoami`, gated on no scope at all. The literal value matches the
18
+ * server's own `ContentManagementRouteScopes.AuthenticatedOnly` (`"*"`) exactly, rather than a
19
+ * TS-side synonym for it — the two would otherwise be two spellings of one fact, and the parity
20
+ * fixture/test would only be checking that both sides remembered to use their own spelling
21
+ * consistently, not that they agree. Never a real scope string, so it can never be satisfied by a
22
+ * key acquiring one.
23
+ */
24
+ export const AUTHENTICATED = '*';
25
+ /**
26
+ * The three entity kinds `content_write` may commit immediately from the in-app assistant (spec
27
+ * 939-ai-inline-assistant) rather than as a deferred suggestion: `component` and `node` implement
28
+ * `IVersionedEntity` server-side; `nodePayload` writes the same `ExperienceNode` row through its own
29
+ * route (`PUT /experience/nodes/{id}/payload`) and so qualifies too. `contract` does **not** — it
30
+ * implements only `IConcurrencyProtected` (a bespoke additive/breaking generation counter, not the
31
+ * generic save-history surface) — so it stays deferred like every other non-versioned kind. This
32
+ * field carries no meaning for `content-mcp` itself (an external agent's write always executes
33
+ * directly, immediately, regardless of tier); it exists here only so this file stays the one place
34
+ * that states the fact, mirrored server-side by `ManagementToolCatalog.ContentWriteImmediateKinds`
35
+ * and held in parity by `tool-catalogue.json`.
36
+ */
37
+ export const CONTENT_WRITE_IMMEDIATE_KINDS = ['component', 'node', 'nodePayload'];
38
+ /**
39
+ * The permission the acting role must hold, beside the key's scope, to write or delete a kind. A
40
+ * scope is the key's ceiling and a permission is the role's, so a key holding `authoring` can still
41
+ * be refused: a Contract needs `content.contracts.manage`, which Member does not hold. Held in step
42
+ * with the server's `ManagementToolCatalog.KindPermissions` by the same fixture as the tools.
43
+ */
44
+ export const KIND_PERMISSIONS = {
45
+ contract: 'content.contracts.manage',
46
+ template: 'content.templates.manage',
47
+ };
48
+ export const TOOL_CATALOG = [
49
+ { name: 'content_whoami', requiredScope: AUTHENTICATED, readOnly: true },
50
+ { name: 'content_describe', requiredScope: SCOPE_READ, readOnly: true },
51
+ { name: 'content_find', requiredScope: SCOPE_READ, readOnly: true },
52
+ { name: 'content_get', requiredScope: SCOPE_READ, readOnly: true, kinds: WRITABLE_KINDS },
53
+ { name: 'content_topology', requiredScope: SCOPE_READ, readOnly: true },
54
+ { name: 'content_operation_status', requiredScope: SCOPE_READ, readOnly: true },
55
+ {
56
+ name: 'content_write',
57
+ requiredScope: SCOPE_AUTHORING,
58
+ readOnly: false,
59
+ kinds: WRITABLE_KINDS,
60
+ immediateKinds: CONTENT_WRITE_IMMEDIATE_KINDS,
61
+ },
62
+ { name: 'content_delete', requiredScope: SCOPE_AUTHORING, readOnly: false, kinds: WRITABLE_KINDS },
63
+ { name: 'content_publish', requiredScope: SCOPE_PUBLISH, readOnly: false },
64
+ // Corrected from SCOPE_WRITE (spec 887): the tool's own always-executed first call, /export,
65
+ // needs only read server-side. See register.ts's ToolContext comment on `canTransfer` for the
66
+ // full reasoning — SCOPE_WRITE is still what the tool's optional apply half needs, but that half
67
+ // authenticates as a wholly separate `target` key this session's own scopes never described.
68
+ { name: 'content_transfer', requiredScope: SCOPE_READ, readOnly: false },
69
+ ];
70
+ function descriptorFor(name) {
71
+ const descriptor = TOOL_CATALOG.find((tool) => tool.name === name);
72
+ if (!descriptor)
73
+ throw new Error(`No catalog entry for tool "${name}" — add one to TOOL_CATALOG.`);
74
+ return descriptor;
75
+ }
76
+ /** Whether `session` may see the named tool, per the catalogue's `requiredScope`. */
77
+ export function sessionCanUse(session, toolName) {
78
+ const { requiredScope } = descriptorFor(toolName);
79
+ return requiredScope === AUTHENTICATED || session.has(requiredScope);
80
+ }
81
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../../src/apps/content/tools/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1E;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAY,CAAA;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,CAAU,CAAA;AAY1F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkD;IAC7E,QAAQ,EAAE,0BAA0B;IACpC,QAAQ,EAAE,0BAA0B;CACrC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAA8B;IACrD,EAAE,IAAI,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxE,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvE,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;IACnE,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE;IACzF,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvE,EAAE,IAAI,EAAE,0BAA0B,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC/E;QACE,IAAI,EAAE,eAAe;QACrB,aAAa,EAAE,eAAe;QAC9B,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,cAAc;QACrB,cAAc,EAAE,6BAA6B;KAC9C;IACD,EAAE,IAAI,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE;IAClG,EAAE,IAAI,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC1E,6FAA6F;IAC7F,8FAA8F;IAC9F,iGAAiG;IACjG,6FAA6F;IAC7F,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE;CAChE,CAAA;AAEV,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;IAClE,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,8BAA8B,CAAC,CAAA;IAClG,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,OAAwC,EAAE,QAAgB;IACtF,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACjD,OAAO,aAAa,KAAK,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;AACtE,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * `content_find`'s paging cursor.
3
+ *
4
+ * **The problem this exists for.** `content_find` puts two listings behind one tool, because both
5
+ * answer "what is already here" and an agent asking that should not have to know which one can
6
+ * filter. But they page differently, and not merely by parameter name: `GET /items` is cursor-paged
7
+ * (`{items, nextCursor}`), while `GET /components` is offset-paged (`page`/`pageSize`, answering
8
+ * `{items, totalCount, page, pageSize}`) and returns no cursor at all. The tool's own schema promises
9
+ * `limit` and `cursor` for both, and the search branch once forwarded neither — so an agent
10
+ * paginating a search got page one forever, with nothing indicating its parameters were discarded.
11
+ *
12
+ * So the tool keeps its promise and normalizes: this module turns a page number into an opaque
13
+ * cursor, and an agent never sees which paging model it is riding.
14
+ *
15
+ * **This is not the knowledge the drift guard forbids.** Knowing that `/components` pages by `page`
16
+ * is the same category as knowing a Contract lives at `/contracts` — a fact about one endpoint's
17
+ * request shape, not about what a Contract may contain. It follows `toPublishItem`'s precedent: this
18
+ * server already normalizes an endpoint's irregular shape rather than documenting it, precisely
19
+ * because neither obvious move worked unaided.
20
+ */
21
+ /** What a cursor turned out to be. `malformed` is separate from `passthrough` on purpose — see {@link decodeCursor}. */
22
+ export type DecodedCursor = {
23
+ kind: 'search';
24
+ page: number;
25
+ } | {
26
+ kind: 'passthrough';
27
+ } | {
28
+ kind: 'malformed';
29
+ };
30
+ /** The next page of a components search, as one opaque string. */
31
+ export declare function encodeSearchCursor(page: number): string;
32
+ /**
33
+ * Classifies a cursor the agent sent back.
34
+ *
35
+ * A string without the prefix is the server's own and passes through to `/items` untouched — which
36
+ * is exactly what it already was before this spec, so nothing an agent is holding mid-session breaks.
37
+ *
38
+ * A string *with* the prefix that will not decode is `malformed` rather than quietly becoming page
39
+ * one. Defaulting it would be this spec's own defect in miniature: an input accepted, discarded, and
40
+ * answered with a plausible-looking result.
41
+ */
42
+ export declare function decodeCursor(cursor: string | undefined): DecodedCursor;
43
+ /**
44
+ * The cursor for the page after this one, or `null` when there is none.
45
+ *
46
+ * **`null` has to mean exactly "no next page", never "probably not".** An agent paging until
47
+ * `nextCursor` is `null` must terminate, and must not make one extra call that returns an empty
48
+ * page. Derived from the response's own `totalCount`/`page`/`pageSize` rather than from what was
49
+ * requested, since the server may legitimately return a smaller page than asked for (it reduces
50
+ * `pageSize` above 100 to 100, and says so in the response).
51
+ *
52
+ * **The member is `totalCount`** (the server's `ComponentListResponse`). This read `total` until
53
+ * issue #821's work found it: no response has ever carried `total`, so every search answered
54
+ * `nextCursor: null` after page one, which an agent reads as "no more results". The tests passed
55
+ * because their stubs invented the same `total`. A stub here has to copy the server's shape, never
56
+ * this function's expectation of it.
57
+ *
58
+ * Returns `null` for any response whose paging members are missing or unusable: an unpageable answer
59
+ * is the end of the walk, which terminates, where an emitted cursor would loop.
60
+ */
61
+ export declare function nextSearchCursor(response: unknown): string | null;
62
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../src/apps/content/tools/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAeH,wHAAwH;AACxH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAA;AAEzB,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAmBtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CASjE"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * `content_find`'s paging cursor.
3
+ *
4
+ * **The problem this exists for.** `content_find` puts two listings behind one tool, because both
5
+ * answer "what is already here" and an agent asking that should not have to know which one can
6
+ * filter. But they page differently, and not merely by parameter name: `GET /items` is cursor-paged
7
+ * (`{items, nextCursor}`), while `GET /components` is offset-paged (`page`/`pageSize`, answering
8
+ * `{items, totalCount, page, pageSize}`) and returns no cursor at all. The tool's own schema promises
9
+ * `limit` and `cursor` for both, and the search branch once forwarded neither — so an agent
10
+ * paginating a search got page one forever, with nothing indicating its parameters were discarded.
11
+ *
12
+ * So the tool keeps its promise and normalizes: this module turns a page number into an opaque
13
+ * cursor, and an agent never sees which paging model it is riding.
14
+ *
15
+ * **This is not the knowledge the drift guard forbids.** Knowing that `/components` pages by `page`
16
+ * is the same category as knowing a Contract lives at `/contracts` — a fact about one endpoint's
17
+ * request shape, not about what a Contract may contain. It follows `toPublishItem`'s precedent: this
18
+ * server already normalizes an endpoint's irregular shape rather than documenting it, precisely
19
+ * because neither obvious move worked unaided.
20
+ */
21
+ /**
22
+ * The literal marker every cursor this module issues carries.
23
+ *
24
+ * **Detection has to be exact, not probabilistic.** An `/items` cursor is itself opaque base64url
25
+ * (the server's own `ManagementItemsCursor`), so "try to parse it as ours" would be a guess that
26
+ * usually works — and a call that usually works is the entire subject of this spec. With the prefix,
27
+ * a cursor either is ours or is not, with no third answer.
28
+ *
29
+ * The `1` is a format version. A later change to what we encode is then detectable rather than
30
+ * silently misread as the current shape.
31
+ */
32
+ const PREFIX = 'mcpc1.';
33
+ /** The next page of a components search, as one opaque string. */
34
+ export function encodeSearchCursor(page) {
35
+ return PREFIX + Buffer.from(JSON.stringify({ b: 'components', p: page }), 'utf8').toString('base64url');
36
+ }
37
+ /**
38
+ * Classifies a cursor the agent sent back.
39
+ *
40
+ * A string without the prefix is the server's own and passes through to `/items` untouched — which
41
+ * is exactly what it already was before this spec, so nothing an agent is holding mid-session breaks.
42
+ *
43
+ * A string *with* the prefix that will not decode is `malformed` rather than quietly becoming page
44
+ * one. Defaulting it would be this spec's own defect in miniature: an input accepted, discarded, and
45
+ * answered with a plausible-looking result.
46
+ */
47
+ export function decodeCursor(cursor) {
48
+ if (cursor === undefined || !cursor.startsWith(PREFIX))
49
+ return { kind: 'passthrough' };
50
+ try {
51
+ const decoded = JSON.parse(Buffer.from(cursor.slice(PREFIX.length), 'base64url').toString('utf8'));
52
+ if (typeof decoded === 'object' &&
53
+ decoded !== null &&
54
+ decoded.b === 'components' &&
55
+ Number.isInteger(decoded.p) &&
56
+ decoded.p >= 1) {
57
+ return { kind: 'search', page: decoded.p };
58
+ }
59
+ }
60
+ catch {
61
+ // Falls through to malformed.
62
+ }
63
+ return { kind: 'malformed' };
64
+ }
65
+ /**
66
+ * The cursor for the page after this one, or `null` when there is none.
67
+ *
68
+ * **`null` has to mean exactly "no next page", never "probably not".** An agent paging until
69
+ * `nextCursor` is `null` must terminate, and must not make one extra call that returns an empty
70
+ * page. Derived from the response's own `totalCount`/`page`/`pageSize` rather than from what was
71
+ * requested, since the server may legitimately return a smaller page than asked for (it reduces
72
+ * `pageSize` above 100 to 100, and says so in the response).
73
+ *
74
+ * **The member is `totalCount`** (the server's `ComponentListResponse`). This read `total` until
75
+ * issue #821's work found it: no response has ever carried `total`, so every search answered
76
+ * `nextCursor: null` after page one, which an agent reads as "no more results". The tests passed
77
+ * because their stubs invented the same `total`. A stub here has to copy the server's shape, never
78
+ * this function's expectation of it.
79
+ *
80
+ * Returns `null` for any response whose paging members are missing or unusable: an unpageable answer
81
+ * is the end of the walk, which terminates, where an emitted cursor would loop.
82
+ */
83
+ export function nextSearchCursor(response) {
84
+ if (typeof response !== 'object' || response === null)
85
+ return null;
86
+ const { totalCount, page, pageSize } = response;
87
+ if (!Number.isFinite(totalCount) || !Number.isFinite(page) || !Number.isFinite(pageSize))
88
+ return null;
89
+ if (pageSize <= 0 || page <= 0)
90
+ return null;
91
+ const seen = page * pageSize;
92
+ return seen < totalCount ? encodeSearchCursor(page + 1) : null;
93
+ }
94
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../../src/apps/content/tools/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,GAAG,QAAQ,CAAA;AAQvB,kEAAkE;AAClE,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;AACzG,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAA;IAEtF,IAAI,CAAC;QACH,MAAM,OAAO,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;QAC3G,IACE,OAAO,OAAO,KAAK,QAAQ;YAC3B,OAAO,KAAK,IAAI;YACf,OAA2B,CAAC,CAAC,KAAK,YAAY;YAC/C,MAAM,CAAC,SAAS,CAAE,OAA2B,CAAC,CAAC,CAAC;YAC/C,OAAyB,CAAC,CAAC,IAAI,CAAC,EACjC,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAG,OAAyB,CAAC,CAAC,EAAE,CAAA;QAC/D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAiB;IAChD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAElE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,QAAwE,CAAA;IAC/G,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IACrG,IAAK,QAAmB,IAAI,CAAC,IAAK,IAAe,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAEnE,MAAM,IAAI,GAAI,IAAe,GAAI,QAAmB,CAAA;IACpD,OAAO,IAAI,GAAI,UAAqB,CAAC,CAAC,CAAC,kBAAkB,CAAE,IAAe,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACxF,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { ContentClient } from '../client.js';
3
+ import type { Session } from '../session.js';
4
+ /**
5
+ * The ten tools.
6
+ *
7
+ * They are **task-shaped**, not endpoint-shaped: one per thing an agent does, never one per REST
8
+ * route or per entity kind. The API a management key reaches is roughly thirty endpoint groups, so a
9
+ * generated one-tool-per-route surface would crowd an agent's context with dozens of entries to
10
+ * express nine tasks — which is why the tools are not generated from the API's OpenAPI document, and
11
+ * why the case against doing so grows stronger as the API grows.
12
+ *
13
+ * The payloads are deliberately opaque. `content_write` takes a `kind` and an object, and this
14
+ * module has no idea what belongs in that object: the agent learns each Contract's shape from
15
+ * `content_describe` at runtime, and the server validates what arrives. A per-kind tool schema
16
+ * would be a second copy of the content model living here, stale the first time a FieldType ships —
17
+ * exactly the drift this server is built to avoid.
18
+ */
19
+ export type ToolContext = {
20
+ client: ContentClient;
21
+ session: Session;
22
+ /** The credential for the environment `content_transfer` imports into, when one is configured. */
23
+ target: ContentClient | null;
24
+ /**
25
+ * Reported by `content_whoami`, so an agent can read the build it is talking to rather than
26
+ * inferring it from which tools happen to exist.
27
+ *
28
+ * Passed in rather than imported from `server.ts`: that module already imports this one, so
29
+ * reaching back for the constant would make a module cycle — one that happens to work, since
30
+ * nothing here reads it at module scope, which is exactly the kind of thing that stops being true
31
+ * quietly.
32
+ */
33
+ serverVersion: string;
34
+ };
35
+ export declare function registerTools(server: McpServer, context: ToolContext): void;
36
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/apps/content/tools/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,kGAAkG;IAClG,MAAM,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5B;;;;;;;;OAQG;IACH,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAwBD,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAmf3E"}