@forumone/throughline-components 0.3.1 → 0.5.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 (39) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +3 -1
  3. package/dist/options.d.ts +3 -6
  4. package/dist/options.d.ts.map +1 -1
  5. package/dist/options.js +2 -4
  6. package/dist/options.js.map +1 -1
  7. package/dist/plugin.d.ts.map +1 -1
  8. package/dist/plugin.js +12 -40
  9. package/dist/plugin.js.map +1 -1
  10. package/dist/tools/descriptors.d.ts +34 -0
  11. package/dist/tools/descriptors.d.ts.map +1 -0
  12. package/dist/tools/descriptors.js +43 -0
  13. package/dist/tools/descriptors.js.map +1 -0
  14. package/dist/tools/find-anti-pattern.d.ts.map +1 -1
  15. package/dist/tools/find-anti-pattern.js +2 -2
  16. package/dist/tools/find-anti-pattern.js.map +1 -1
  17. package/dist/tools/get-contract.d.ts.map +1 -1
  18. package/dist/tools/get-contract.js +2 -2
  19. package/dist/tools/get-contract.js.map +1 -1
  20. package/dist/tools/get-tokens.d.ts.map +1 -1
  21. package/dist/tools/get-tokens.js +2 -2
  22. package/dist/tools/get-tokens.js.map +1 -1
  23. package/dist/tools/get-variants.d.ts.map +1 -1
  24. package/dist/tools/get-variants.js +2 -2
  25. package/dist/tools/get-variants.js.map +1 -1
  26. package/dist/tools/index.d.ts +1 -0
  27. package/dist/tools/index.d.ts.map +1 -1
  28. package/dist/tools/index.js +1 -0
  29. package/dist/tools/index.js.map +1 -1
  30. package/dist/tools/list-components.d.ts.map +1 -1
  31. package/dist/tools/list-components.js +2 -2
  32. package/dist/tools/list-components.js.map +1 -1
  33. package/dist/tools/suggest-for-intent.d.ts.map +1 -1
  34. package/dist/tools/suggest-for-intent.js +2 -2
  35. package/dist/tools/suggest-for-intent.js.map +1 -1
  36. package/dist/tools/validate-composition.d.ts.map +1 -1
  37. package/dist/tools/validate-composition.js +2 -2
  38. package/dist/tools/validate-composition.js.map +1 -1
  39. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,105 @@
1
1
  # @forumone/throughline-components
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a9262da: Per-tool gating works, because tool names no longer wait for `onInit`
8
+
9
+ `@payloadcms/plugin-mcp` generates one per-key checkbox per tool while the host's
10
+ config is being built, and then gates every call on the checkbox matching the
11
+ tool's name. Every Throughline tool was built at `onInit` — each closes over
12
+ `payload`, the publishing service or the manifest loader — so the array it maps
13
+ over was empty, no checkboxes were generated, and its `?? false` denied all 27
14
+ tools to every key. A valid key got a 200 and an empty `tools/list`, with nothing
15
+ wrong on either side.
16
+
17
+ The plugin needs only `name` and `description` then, and neither needs a Payload.
18
+ So a server now **declares** its tools as the config is built and **binds** their
19
+ handlers at `onInit`:
20
+
21
+ ```ts
22
+ options.mcpTools?.declare(PUBLISHING_TOOL_DESCRIPTORS, { serverName: 'publishing' })
23
+ // …later, at onInit:
24
+ options.mcpTools?.add(tools, { serverName: 'publishing' })
25
+ ```
26
+
27
+ Each package gained a `tools/descriptors.ts` holding every tool's name and
28
+ description; the factories spread from it, so the checkbox and the MCP client
29
+ cannot describe a tool differently. A `descriptors.test.ts` in each package
30
+ asserts the two sets match, without needing a database.
31
+
32
+ `createMcpToolCollector` gains `declare()` and an `unbound` list. Both mismatches
33
+ are refused rather than absorbed: a tool built but never declared throws at
34
+ `onInit` (it would otherwise be denied to every key, silently), and a tool
35
+ declared but never bound stays advertised with a handler that explains itself.
36
+
37
+ **Order in the host's plugin array is now load-bearing.** Every tool-bearing
38
+ server must come before `mcpPlugin`, or it declares into an array that has
39
+ already been read. It was only a convention before; it is a requirement now, and
40
+ the failure mode — a server's tools missing from every key — is the one this
41
+ change exists to remove.
42
+
43
+ `requiredScope` stays declared and read by nothing. Enforcement is the checkbox;
44
+ these record which tools are consequential, and are the mapping a scope-aware
45
+ default would be built from.
46
+
47
+ The playground registers `mcpPlugin` for the first time, so the suite's only
48
+ end-to-end host now exercises the tools rather than just their composition.
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [a9262da]
53
+ - @forumone/throughline-core@0.8.0
54
+
55
+ ## 0.4.0
56
+
57
+ ### Minor Changes
58
+
59
+ - 3140ea0: One MCP transport, not seven
60
+
61
+ Every plugin served its own `POST /<prefix>/mcp` on a 146-line JSON-RPC subset of
62
+ the protocol that spoke `tools/list` and `tools/call` and nothing else. Payload
63
+ ships an MCP server built on the official SDK — streamable HTTP, sessions, per-key
64
+ capability checkboxes — and the tools were never the transport. They now reach a
65
+ client through the host's `@payloadcms/plugin-mcp`, on one `/api/mcp`, via the
66
+ collector `createMcpToolCollector` already provided.
67
+
68
+ **Breaking.** Removed from `@forumone/throughline-core`: `createMcpHandler`,
69
+ `McpHandlerOptions`, `createApiKeysCollection`, `ApiKeysCollectionOptions`,
70
+ `DEFAULT_API_KEYS_SLUG`, `createBearerTokenAuthenticator`,
71
+ `BearerTokenAuthenticatorOptions`, `generateApiKey`. Removed from
72
+ `@forumone/throughline-plugin-contract`: `McpAuthenticator`, `McpAuthResult`.
73
+ `sha256Hex` stays exported, from `./utils` rather than `./auth`.
74
+
75
+ `routePrefix` is gone from `auditQueryPlugin`, `componentsPlugin` and
76
+ `integrationsPlugin` — omitted from their options types, so passing one is a
77
+ compile error rather than config that reads as if it does something. `/mcp` was
78
+ the only endpoint any of the three served. `publishingPlugin`, `approvalsPlugin`
79
+ and `formsPlugin` keep theirs; they still serve admin controls, the approval
80
+ action link and the public form post.
81
+
82
+ **A host that passes no `mcpTools` collector now has no MCP surface.** There is no
83
+ per-server endpoint left as a fallback. This is a config change of one line per
84
+ plugin, and `createMcpToolCollector`'s own docs carry the shape.
85
+
86
+ **What this costs, stated plainly.** `requiredScope` is now read by nothing —
87
+ `plugin-mcp` gates on checkboxes generated at config time, which this suite cannot
88
+ fill because every tool is built at `onInit`. So a key that authenticates reaches
89
+ every collected tool, exactly as an all-or-nothing per-server key did. The
90
+ declarations are kept because they are the mapping those checkboxes need; #78
91
+ tracks restoring enforcement, and the type's own doc comment says so.
92
+
93
+ Also drops the key collection from the playground, which leaves that app with no
94
+ MCP surface at all until `mcpPlugin` can be wired there — #79, blocked on moving
95
+ it off `payload@^3.83.0`.
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [3140ea0]
100
+ - @forumone/throughline-plugin-contract@0.4.0
101
+ - @forumone/throughline-core@0.7.0
102
+
3
103
  ## 0.3.1
4
104
 
5
105
  ### Patch Changes
package/README.md CHANGED
@@ -4,7 +4,9 @@ MCP server that exposes a design system manifest as conversational primitives. D
4
4
 
5
5
  ## What this package provides
6
6
 
7
- Seven MCP tools served at `<api-base>/<routePrefix>/mcp`. With Payload's default API base (`/api`) and the plugin's default `routePrefix` (`/components`), the user-facing URL is `/api/components/mcp`.
7
+ Seven MCP tools, handed to the host's collector at `onInit` and served by
8
+ `@payloadcms/plugin-mcp` on one `/api/mcp`. Pass `mcpTools` or they reach nobody.
9
+ This plugin serves no HTTP endpoint of its own, and so takes no `routePrefix`.
8
10
 
9
11
  | Tool | Purpose |
10
12
  |---|---|
package/dist/options.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface MatchingConfig {
24
24
  /** Maximum number of recommendations from `suggest_for_intent`. Default: 5. */
25
25
  maxRecommendations?: number;
26
26
  }
27
- export interface ComponentsPluginOptions extends BaseCorePluginOptions {
27
+ export interface ComponentsPluginOptions extends Omit<BaseCorePluginOptions, 'routePrefix'> {
28
28
  /** Required: where the design system manifest comes from. */
29
29
  manifest: ManifestSource;
30
30
  /** Optional: how the plugin matches intents to components. Defaults to TF-IDF. */
@@ -45,7 +45,6 @@ export interface ComponentsPluginOptions extends BaseCorePluginOptions {
45
45
  }
46
46
  export declare const ComponentsPluginOptionsSchema: z.ZodObject<{
47
47
  enabled: z.ZodOptional<z.ZodBoolean>;
48
- routePrefix: z.ZodOptional<z.ZodString>;
49
48
  manifest: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
50
49
  type: z.ZodLiteral<"object">;
51
50
  manifest: z.ZodUnknown;
@@ -103,12 +102,11 @@ export declare const ComponentsPluginOptionsSchema: z.ZodObject<{
103
102
  slug: string;
104
103
  documentId?: string | undefined;
105
104
  };
105
+ enabled?: boolean | undefined;
106
106
  matching?: {
107
107
  strategy: "tfidf";
108
108
  maxRecommendations?: number | undefined;
109
109
  } | undefined;
110
- enabled?: boolean | undefined;
111
- routePrefix?: string | undefined;
112
110
  }, {
113
111
  manifest: {
114
112
  type: "object";
@@ -122,12 +120,11 @@ export declare const ComponentsPluginOptionsSchema: z.ZodObject<{
122
120
  slug: string;
123
121
  documentId?: string | undefined;
124
122
  };
123
+ enabled?: boolean | undefined;
125
124
  matching?: {
126
125
  strategy: "tfidf";
127
126
  maxRecommendations?: number | undefined;
128
127
  } | undefined;
129
- enabled?: boolean | undefined;
130
- routePrefix?: string | undefined;
131
128
  }>;
132
129
  /**
133
130
  * Validates plugin options at load time. Throws with a multi-line message
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAA;AAErE,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEr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EAAE,OAAO,CAAA;IACjB,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAOD,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,aAAa,CAAC;IACzF,6DAA6D;IAC7D,QAAQ,EAAE,cAAc,CAAA;IACxB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,cAAc,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B;AAgBD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAA;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAOzF"}
package/dist/options.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { formatZodIssues } from '@forumone/throughline-core';
1
2
  import { z } from 'zod';
2
3
  const ManifestSourceSchema = z.discriminatedUnion('type', [
3
4
  z.object({ type: z.literal('object'), manifest: z.unknown() }),
@@ -14,7 +15,6 @@ const ManifestSourceSchema = z.discriminatedUnion('type', [
14
15
  ]);
15
16
  export const ComponentsPluginOptionsSchema = z.object({
16
17
  enabled: z.boolean().optional(),
17
- routePrefix: z.string().optional(),
18
18
  manifest: ManifestSourceSchema,
19
19
  matching: z
20
20
  .object({
@@ -32,9 +32,7 @@ export const ComponentsPluginOptionsSchema = z.object({
32
32
  export function validateOptions(options) {
33
33
  const result = ComponentsPluginOptionsSchema.safeParse(options);
34
34
  if (!result.success) {
35
- const issues = result.error.issues
36
- .map((i) => ` - ${i.path.join('.') || '(root)'}: ${i.message}`)
37
- .join('\n');
35
+ const issues = formatZodIssues(result.error);
38
36
  throw new Error(`Invalid componentsPlugin options:\n${issues}`);
39
37
  }
40
38
  return options;
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","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 {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAGvE,OAAO,EAAE,KAAK,uBAAuB,EAAmB,MAAM,cAAc,CAAA;AA6B5E,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,CAsE9D,CAAA"}
package/dist/plugin.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import { getPluginRegistry } from '@forumone/throughline-plugin-contract';
2
- import { createMcpHandler, createNamedLogger, defaultLogger, getAuditWriter, } from '@forumone/throughline-core';
2
+ import { createNamedLogger, defaultLogger, getAuditWriter } from '@forumone/throughline-core';
3
3
  import { validateOptions } from './options.js';
4
4
  import { createManifestLoader } from './manifest-source.js';
5
5
  import { createTfidfMatcher } from './matching/index.js';
6
- import { createFindAntiPatternTool, createGetContractTool, createGetTokensTool, createGetVariantsTool, createListComponentsTool, createSuggestForIntentTool, createValidateCompositionTool, } from './tools/index.js';
6
+ import { COMPONENTS_TOOL_DESCRIPTORS, createFindAntiPatternTool, createGetContractTool, createGetTokensTool, createGetVariantsTool, createListComponentsTool, createSuggestForIntentTool, createValidateCompositionTool, } from './tools/index.js';
7
7
  import { validateComposition, } from './validation/composition.js';
8
8
  const PLUGIN_ID = '@forumone/throughline-components';
9
9
  const PLUGIN_VERSION = '0.1.0';
10
- const MCP_HANDLER_SYMBOL = Symbol.for('@forumone/throughline/components-mcp-handler');
11
10
  /**
12
11
  * Internal IPC point: peer plugins (publishing, etc.) read this symbol from
13
12
  * the Payload instance to call composition validation directly without
@@ -19,29 +18,17 @@ export const componentsPlugin = (rawOptions) => (incomingConfig) => {
19
18
  if (rawOptions.enabled === false)
20
19
  return incomingConfig;
21
20
  const options = validateOptions(rawOptions);
22
- // Payload mounts top-level endpoints under its API base (default /api),
23
- // so the path passed here MUST NOT include /api itself or it ends up
24
- // doubled (e.g. /api/api/components/mcp). The user-facing URL is still
25
- // /api/components/mcp.
26
- const routePrefix = options.routePrefix ?? '/components';
27
21
  const logger = createNamedLogger('components', options.logger ?? defaultLogger);
28
22
  const maxRecommendations = options.matching?.maxRecommendations ?? 5;
23
+ /*
24
+ Declared here, bound at `onInit` — `mcpPlugin` generates its per-key
25
+ checkboxes from these names and descriptions while the config is built, and
26
+ denies any tool it has no checkbox for. This plugin must therefore come
27
+ before `mcpPlugin` in the host's array.
28
+ */
29
+ options.mcpTools?.declare(COMPONENTS_TOOL_DESCRIPTORS, { serverName: 'components' });
29
30
  return {
30
31
  ...incomingConfig,
31
- endpoints: [
32
- ...(incomingConfig.endpoints ?? []),
33
- {
34
- path: `${routePrefix}/mcp`,
35
- method: 'post',
36
- handler: async (req) => {
37
- const handler = req.payload[MCP_HANDLER_SYMBOL];
38
- if (!handler) {
39
- return new Response(JSON.stringify({ error: 'Components MCP not initialized' }), { status: 503, headers: { 'content-type': 'application/json' } });
40
- }
41
- return handler(req);
42
- },
43
- },
44
- ],
45
32
  onInit: async (payload) => {
46
33
  if (incomingConfig.onInit) {
47
34
  await incomingConfig.onInit(payload);
@@ -69,17 +56,10 @@ export const componentsPlugin = (rawOptions) => (incomingConfig) => {
69
56
  createValidateCompositionTool({ loader, auditWriter }),
70
57
  createFindAntiPatternTool({ loader, auditWriter }),
71
58
  ];
72
- // Payload's own MCP plugin, when the host is using it. See the option's
73
- // note — `onInit` is both the earliest these tools can exist and still
74
- // early enough that the array is read populated.
59
+ // Payload's own MCP plugin, and the only transport these tools have.
60
+ // `onInit` is both the earliest they can exist and still early enough
61
+ // that `mcpPlugin` reads the array populated.
75
62
  options.mcpTools?.add(tools, { serverName: 'components', logger });
76
- const handler = createMcpHandler({
77
- payload,
78
- serverName: 'components',
79
- tools,
80
- logger,
81
- });
82
- attachMcpHandler(payload, handler);
83
63
  attachValidator(payload, loader);
84
64
  registry.register({
85
65
  id: PLUGIN_ID,
@@ -94,14 +74,6 @@ export const componentsPlugin = (rawOptions) => (incomingConfig) => {
94
74
  },
95
75
  };
96
76
  };
97
- function attachMcpHandler(payload, handler) {
98
- Object.defineProperty(payload, MCP_HANDLER_SYMBOL, {
99
- value: handler,
100
- enumerable: false,
101
- writable: false,
102
- configurable: false,
103
- });
104
- }
105
77
  /**
106
78
  * Attaches a composition-validation function to the Payload instance under
107
79
  * VALIDATOR_SYMBOL so peer plugins (the publishing server) can validate
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAgC,eAAe,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAuB,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAGL,mBAAmB,GACpB,MAAM,6BAA6B,CAAA;AAEpC,MAAM,SAAS,GAAG,kCAAkC,CAAA;AACpD,MAAM,cAAc,GAAG,OAAO,CAAA;AAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAA;AACrF;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAA;AAIjF,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,cAAc,EAAE,EAAE;IACjC,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK;QAAE,OAAO,cAAc,CAAA;IAEvD,MAAM,OAAO,GAAG,eAAe,C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AE,SAAS;gBACb,OAAO,EAAE,cAAc;gBACvB,YAAY,EAAE;oBACZ,kBAAkB;oBAClB,kBAAkB;oBAClB,iBAAiB;oBACjB,wBAAwB;iBACzB;aACF,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAEH;;;;GAIG;AACH,SAAS,eAAe,CAAC,OAAe,EAAE,MAAsB;IAC9D,MAAM,SAAS,GAAG,KAAK,EAAE,KAAuB,EAA8B,EAAE;QAC9E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;QACnC,OAAO,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC,CAAA;IACD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE;QAC/C,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK;KACpB,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { McpToolDescriptor } from '@forumone/throughline-core';
2
+ export declare const COMPONENTS_TOOLS: {
3
+ readonly listComponents: {
4
+ readonly name: "list_components";
5
+ readonly description: "Returns the list of components available in the design system. Use this to discover what components exist before composing content.";
6
+ };
7
+ readonly getContract: {
8
+ readonly name: "get_contract";
9
+ readonly description: "Returns the full contract for a named component, including intent, composition rules, content fields, variants, tokens, accessibility requirements, examples, and anti-examples.";
10
+ };
11
+ readonly getVariants: {
12
+ readonly name: "get_variants";
13
+ readonly description: "Returns the available variants for a component, with descriptions and guidance about when to use each.";
14
+ };
15
+ readonly getTokens: {
16
+ readonly name: "get_tokens";
17
+ readonly description: "Returns the design tokens a component consumes plus the configurable token-backed props and their allowed values.";
18
+ };
19
+ readonly suggestForIntent: {
20
+ readonly name: "suggest_for_intent";
21
+ readonly description: "Given a natural-language description of what the author wants to accomplish, returns ranked component recommendations with reasoning. Optionally accepts the existing page context so duplicate Heroes / composition conflicts surface as warnings on the suggestions.";
22
+ };
23
+ readonly validateComposition: {
24
+ readonly name: "validate_composition";
25
+ readonly description: "Validates a proposed page layout against the design system's composition rules. Returns errors (blocking publish) and warnings (advisory). Call this before recommending a final layout.";
26
+ };
27
+ readonly findAntiPattern: {
28
+ readonly name: "find_anti_pattern";
29
+ readonly description: "Scans a proposed composition for known design anti-patterns (multiple Heroes, Hero at the bottom of a page, etc.). Returns matches with explanation and suggested alternatives. Use before publishing to surface editorial issues.";
30
+ };
31
+ };
32
+ /** Every tool this server contributes, for the collector. */
33
+ export declare const COMPONENTS_TOOL_DESCRIPTORS: readonly McpToolDescriptor[];
34
+ //# sourceMappingURL=descriptors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAYnE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCyB,CAAA;AAEtD,6DAA6D;AAC7D,eAAO,MAAM,2BAA2B,EAAE,SAAS,iBAAiB,EACnC,CAAA"}
@@ -0,0 +1,43 @@
1
+ /*
2
+ This server's tools, by name and description, knowable without a Payload.
3
+
4
+ `@payloadcms/plugin-mcp` reads exactly these two fields while the host's config
5
+ is being built, to generate one per-key checkbox per tool, and denies any tool it
6
+ has no checkbox for. The handlers close over the manifest loader and the matcher,
7
+ which are built at `onInit` — the names never needed to wait for them.
8
+
9
+ The factories below spread these, so the two cannot drift.
10
+ */
11
+ export const COMPONENTS_TOOLS = {
12
+ listComponents: {
13
+ name: 'list_components',
14
+ description: 'Returns the list of components available in the design system. Use this to discover what components exist before composing content.',
15
+ },
16
+ getContract: {
17
+ name: 'get_contract',
18
+ description: 'Returns the full contract for a named component, including intent, composition rules, content fields, variants, tokens, accessibility requirements, examples, and anti-examples.',
19
+ },
20
+ getVariants: {
21
+ name: 'get_variants',
22
+ description: 'Returns the available variants for a component, with descriptions and guidance about when to use each.',
23
+ },
24
+ getTokens: {
25
+ name: 'get_tokens',
26
+ description: 'Returns the design tokens a component consumes plus the configurable token-backed props and their allowed values.',
27
+ },
28
+ suggestForIntent: {
29
+ name: 'suggest_for_intent',
30
+ description: 'Given a natural-language description of what the author wants to accomplish, returns ranked component recommendations with reasoning. Optionally accepts the existing page context so duplicate Heroes / composition conflicts surface as warnings on the suggestions.',
31
+ },
32
+ validateComposition: {
33
+ name: 'validate_composition',
34
+ description: "Validates a proposed page layout against the design system's composition rules. Returns errors (blocking publish) and warnings (advisory). Call this before recommending a final layout.",
35
+ },
36
+ findAntiPattern: {
37
+ name: 'find_anti_pattern',
38
+ description: 'Scans a proposed composition for known design anti-patterns (multiple Heroes, Hero at the bottom of a page, etc.). Returns matches with explanation and suggested alternatives. Use before publishing to surface editorial issues.',
39
+ },
40
+ };
41
+ /** Every tool this server contributes, for the collector. */
42
+ export const COMPONENTS_TOOL_DESCRIPTORS = Object.values(COMPONENTS_TOOLS);
43
+ //# sourceMappingURL=descriptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/tools/descriptors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;EASE;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE;QACd,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,qIAAqI;KACxI;IACD,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,kLAAkL;KACrL;IACD,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,wGAAwG;KAC3G;IACD,SAAS,EAAE;QACT,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,mHAAmH;KACtH;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,wQAAwQ;KAC3Q;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,0LAA0L;KAC7L;IACD,eAAe,EAAE;QACf,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,oOAAoO;KACvO;CACmD,CAAA;AAEtD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,2BAA2B,GACtC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"find-anti-pattern.d.ts","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CA+BtF"}
1
+ {"version":3,"file":"find-anti-pattern.d.ts","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAI3D,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CA6BtF"}
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { auditContext, withMeta } from '@forumone/throughline-core';
3
3
  import { findAntiPatterns } from '../validation/composition.js';
4
+ import { COMPONENTS_TOOLS } from './descriptors.js';
4
5
  export function createFindAntiPatternTool(deps) {
5
6
  const inputSchema = withMeta({
6
7
  blocks: z
@@ -11,8 +12,7 @@ export function createFindAntiPatternTool(deps) {
11
12
  .min(1),
12
13
  });
13
14
  return {
14
- name: 'find_anti_pattern',
15
- description: "Scans a proposed composition for known design anti-patterns (multiple Heroes, Hero at the bottom of a page, etc.). Returns matches with explanation and suggested alternatives. Use before publishing to surface editorial issues.",
15
+ ...COMPONENTS_TOOLS.findAntiPattern,
16
16
  inputSchema,
17
17
  handler: async (input, ctx) => {
18
18
  const manifest = await deps.loader.get();
@@ -1 +1 @@
1
- {"version":3,"file":"find-anti-pattern.js","sourceRoot":"","sources":["../../src/tools/find-anti-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAO/D,MAAM,UAAU,yBAAyB,CAAC,IAAyB;IACjE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,MAAM,EAAE,CAAC;aACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CACH;aACA,GAAG,CAAC,CAAC,CAAC;KACV,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,oOAAoO;QACtO,WAAW;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;YACxC,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE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CAAC;gBACrB,GAAG,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;gBACjC,MAAM,EAAE,0BAA0B;gBAClC,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,mBAAmB;aAC7B,CAAC,CAAA;YAEF,OAAO,EAAE,OAAO,EAAE,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-contract.d.ts","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAiB/E"}
1
+ {"version":3,"file":"get-contract.d.ts","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAe/E"}
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { COMPONENTS_TOOLS } from './descriptors.js';
2
3
  export function createGetContractTool(loader) {
3
4
  return {
4
- name: 'get_contract',
5
- description: 'Returns the full contract for a named component, including intent, composition rules, content fields, variants, tokens, accessibility requirements, examples, and anti-examples.',
5
+ ...COMPONENTS_TOOLS.getContract,
6
6
  inputSchema: z.object({
7
7
  name: z.string().describe('The PascalCase name of the component'),
8
8
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"get-contract.js","sourceRoot":"","sources":["../../src/tools/get-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,UAAU,qBAAqB,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,KAAK,CAAC,IAAI,kCAAkC,EAAE,CAAA;YAC9E,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-tokens.d.ts","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAiB7E"}
1
+ {"version":3,"file":"get-tokens.d.ts","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAe7E"}
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { COMPONENTS_TOOLS } from './descriptors.js';
2
3
  export function createGetTokensTool(loader) {
3
4
  return {
4
- name: 'get_tokens',
5
- description: 'Returns the design tokens a component consumes plus the configurable token-backed props and their allowed values.',
5
+ ...COMPONENTS_TOOLS.getTokens,
6
6
  inputSchema: z.object({
7
7
  name: z.string().describe('The PascalCase name of the component'),
8
8
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"get-tokens.js","sourceRoot":"","sources":["../../src/tools/get-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,UAAU,mBAAmB,CAAC,MAAsB;IACxD,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,mHAAmH;QACrH,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC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1 @@
1
- {"version":3,"file":"get-variants.d.ts","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAiB/E"}
1
+ {"version":3,"file":"get-variants.d.ts","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAe/E"}
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { COMPONENTS_TOOLS } from './descriptors.js';
2
3
  export function createGetVariantsTool(loader) {
3
4
  return {
4
- name: 'get_variants',
5
- description: 'Returns the available variants for a component, with descriptions and guidance about when to use each.',
5
+ ...COMPONENTS_TOOLS.getVariants,
6
6
  inputSchema: z.object({
7
7
  name: z.string().describe('The PascalCase name of the component'),
8
8
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"get-variants.js","sourceRoot":"","sources":["../../src/tools/get-variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC1D,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,wGAAwG;QAC1G,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;SAClE,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,QAAQ,G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S, COMPONENTS_TOOL_DESCRIPTORS } from './descriptors.js';
1
2
  export { createListComponentsTool } from './list-components.js';
2
3
  export { createGetContractTool } from './get-contract.js';
3
4
  export { createGetVariantsTool } from './get-variants.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAA"}
@@ -1,3 +1,4 @@
1
+ export { COMPONENTS_TOOLS, COMPONENTS_TOOL_DESCRIPTORS } from './descriptors.js';
1
2
  export { createListComponentsTool } from './list-components.js';
2
3
  export { createGetContractTool } from './get-contract.js';
3
4
  export { createGetVariantsTool } from './get-variants.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,GAE9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,GAE1B,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,6BAA6B,GAE9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,yBAAyB,GAE1B,MAAM,wBAAwB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAuBlF"}
1
+ {"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAqBlF"}
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { COMPONENTS_TOOLS } from './descriptors.js';
2
3
  export function createListComponentsTool(loader) {
3
4
  return {
4
- name: 'list_components',
5
- description: 'Returns the list of components available in the design system. Use this to discover what components exist before composing content.',
5
+ ...COMPONENTS_TOOLS.listComponents,
6
6
  inputSchema: z.object({
7
7
  category: z
8
8
  .string()
@@ -1 +1 @@
1
- {"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../src/tools/list-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,UAAU,wBAAwB,CAAC,MAAsB;IAC7D,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,qIAAqI;QACvI,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,CAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,0GAA0G,CAAC;SACxH,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;YACnC,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ;gBAC/B,CA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,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,WAAW,EAAE,CAAC,CAAC,WAAW;aAC3B,CAAC,CAAC,CAAA;QACL,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"suggest-for-intent.d.ts","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAA;AAGrE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,WAAW,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,oBAAoB,GAAG,iBAAiB,CAgExF"}
1
+ {"version":3,"file":"suggest-for-intent.d.ts","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAA;AAIrE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,WAAW,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,oBAAoB,GAAG,iBAAiB,CA8DxF"}
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { auditContext, withMeta } from '@forumone/throughline-core';
3
3
  import { validateComposition } from '../validation/composition.js';
4
+ import { COMPONENTS_TOOLS } from './descriptors.js';
4
5
  export function createSuggestForIntentTool(deps) {
5
6
  const inputSchema = withMeta({
6
7
  intent: z
@@ -21,8 +22,7 @@ export function createSuggestForIntentTool(deps) {
21
22
  .optional(),
22
23
  });
23
24
  return {
24
- name: 'suggest_for_intent',
25
- description: "Given a natural-language description of what the author wants to accomplish, returns ranked component recommendations with reasoning. Optionally accepts the existing page context so duplicate Heroes / composition conflicts surface as warnings on the suggestions.",
25
+ ...COMPONENTS_TOOLS.suggestForIntent,
26
26
  inputSchema,
27
27
  handler: async (input, ctx) => {
28
28
  const manifest = await deps.loader.get();
@@ -1 +1 @@
1
- {"version":3,"file":"suggest-for-intent.js","sourceRoot":"","sources":["../../src/tools/suggest-for-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAIrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AASlE,MAAM,UAAU,0BAA0B,CAAC,IAA0B;IACnE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,qFAAqF,CAAC;QAClG,OAAO,EAAE,CAAC;aACP,MAAM,CAAC;YACN,cAAc,EAAE,CAAC;iBACd,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,QAAQ,CAAC,+CAA+C,CAAC;YAC5D,QAAQ,EAAE,CAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,0DAA0D,CAAC;SACxE,CAAC;aACD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M,IAAI,GAAG,GAAG,SAAS,CAAC,IAAI,KAAK,UAAU,KAAK,SAAS,CAAC,WAAW,EAAE,CAAA;IACzE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACtC,OAAO,GAAG,IAAI,UAAU,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AAC9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-composition.d.ts","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG3D,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CA+B9F"}
1
+ {"version":3,"file":"validate-composition.d.ts","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAC9E,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,4BAA4B,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAI3D,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CA6B9F"}
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { auditContext, withMeta } from '@forumone/throughline-core';
3
3
  import { validateComposition } from '../validation/composition.js';
4
+ import { COMPONENTS_TOOLS } from './descriptors.js';
4
5
  export function createValidateCompositionTool(deps) {
5
6
  const inputSchema = withMeta({
6
7
  blocks: z
@@ -11,8 +12,7 @@ export function createValidateCompositionTool(deps) {
11
12
  .min(1),
12
13
  });
13
14
  return {
14
- name: 'validate_composition',
15
- description: "Validates a proposed page layout against the design system's composition rules. Returns errors (blocking publish) and warnings (advisory). Call this before recommending a final layout.",
15
+ ...COMPONENTS_TOOLS.validateComposition,
16
16
  inputSchema,
17
17
  handler: async (input, ctx) => {
18
18
  const manifest = await deps.loader.get();
@@ -1 +1 @@
1
- {"version":3,"file":"validate-composition.js","sourceRoot":"","sources":["../../src/tools/validate-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAOlE,MAAM,UAAU,6BAA6B,CAAC,IAA6B;IACzE,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,MAAM,EAAE,CAAC;aACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,CAAC,CACH;aACA,GAAG,CAAC,CAAC,CAAC;KACV,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,0LAA0L;QAC5L,WAAW;QACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;YACxC,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAA;YAEtE,MAAM,IAAI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K,CAAC;gBACjC,MAAM,EAAE,iBAAiB;gBACzB,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,sBAAsB;aAChC,CAAC,CAAA;YAEF,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forumone/throughline-components",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "MCP server that exposes a design system manifest as conversational primitives for Throughline.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,9 +40,9 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "zod": "^3.23.0",
43
- "@forumone/throughline-core": "0.6.0",
43
+ "@forumone/throughline-core": "0.8.0",
44
44
  "@forumone/throughline-design-contract": "0.3.0",
45
- "@forumone/throughline-plugin-contract": "0.3.0"
45
+ "@forumone/throughline-plugin-contract": "0.4.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^20.17.0",