@adobe/design-data-agent-mcp 1.16.24 → 1.17.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.
- package/README.md +2 -2
- package/package.json +4 -4
- package/skills/design-data/SKILL.md +4 -1
- package/src/tools/read.js +57 -5
package/README.md
CHANGED
|
@@ -185,8 +185,8 @@ node tools/design-data-agent-mcp/src/index.js
|
|
|
185
185
|
| -------------------- | --------------------------------------------------------------- |
|
|
186
186
|
| `primer` | Load full token taxonomy, component list, and field definitions |
|
|
187
187
|
| `resolve_token` | Resolve a token property to its literal value |
|
|
188
|
-
| `query_tokens` | Filter tokens by expression
|
|
189
|
-
| `suggest_token` | Suggest tokens
|
|
188
|
+
| `query_tokens` | Filter tokens by expression; aliases add final `value` |
|
|
189
|
+
| `suggest_token` | Suggest tokens for an intent, each with its final `value` |
|
|
190
190
|
| `token_refinements` | A token's specificity and its narrower and broader neighbors |
|
|
191
191
|
| `describe_component` | Fetch component schema and token bindings |
|
|
192
192
|
| `describe_guideline` | Fetch guideline documentBlocks content and metadata |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-agent-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "MCP server and Claude Code skill for the design-data agent surface — read tools run in-process via wasm",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
34
|
-
"@adobe/design-data": "3.5.
|
|
35
|
-
"@adobe/design-data-wasm": "0.41.
|
|
36
|
-
"@adobe/spectrum-design-data": "4.
|
|
34
|
+
"@adobe/design-data": "3.5.4",
|
|
35
|
+
"@adobe/design-data-wasm": "0.41.4",
|
|
36
|
+
"@adobe/spectrum-design-data": "4.13.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"ava": "^6.0.1"
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
system, token lookup, spec-conformance, drift detection, or token authoring on custom data.
|
|
7
7
|
metadata:
|
|
8
8
|
author: adobe
|
|
9
|
-
version: "1.
|
|
9
|
+
version: "1.17.0"
|
|
10
10
|
when_to_use: >
|
|
11
11
|
Trigger on: design system, design tokens, spec-conformant, drift, validate tokens, token
|
|
12
12
|
authoring, custom dataset, DESIGN_DATA_PATH, design-data validate, design-data diff,
|
|
@@ -100,6 +100,8 @@ $schema=https://spectrum.adobe.com/page/design-token/
|
|
|
100
100
|
> component-indexed in this dataset. Use `describe_component` to see a component's known
|
|
101
101
|
> token bindings instead.
|
|
102
102
|
|
|
103
|
+
> Alias tokens add `value`, the token's own resolved value in its own mode (a dark token shows a dark value; modes the token does not name use `light`, `desktop`, `regular`). Composite values (typography, shadow) are not shown. `view: "full"` also adds `chain`, the alias path. `raw` no longer repeats `$schema` or `uuid`, and there is no `schemaUrl`.
|
|
104
|
+
|
|
103
105
|
> **Exit codes:** `0` = matches found; empty array = no matches (not an error).
|
|
104
106
|
|
|
105
107
|
### Suggest a token from a description — `suggest_token`
|
|
@@ -108,6 +110,7 @@ Required: `intent` (string) — a natural-language description of the design nee
|
|
|
108
110
|
such as `"primary CTA button background color"`.
|
|
109
111
|
|
|
110
112
|
Optional: `limit` (number, default `5`) — the maximum number of suggestions to return.
|
|
113
|
+
Each suggestion carries `value`, that token's own resolved value in its own mode (light, dark and wireframe twins each show theirs; composite values are omitted); `view: "full"` adds the alias `chain`. Results no longer carry `file`.
|
|
111
114
|
Results are ranked by confidence using token names, name-object fields, and description
|
|
112
115
|
text. Use this when the user describes what they need rather than knowing a token name.
|
|
113
116
|
|
package/src/tools/read.js
CHANGED
|
@@ -108,6 +108,46 @@ function getCascadeAwareDir(baseDir, subdir) {
|
|
|
108
108
|
return existsSync(cascadeDir) ? cascadeDir : baseDir;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
const MODE_KEYS = ["colorScheme", "scale", "contrast"];
|
|
112
|
+
const DEFAULT_MODES = {
|
|
113
|
+
colorScheme: "light",
|
|
114
|
+
scale: "desktop",
|
|
115
|
+
contrast: "regular",
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The token's own resolved value (and, in the full view, the alias chain), looked up by its
|
|
120
|
+
* uuid: light/dark/wireframe twins share a name. Modes the token names win over the defaults.
|
|
121
|
+
* Composite values are omitted (they would bloat the output); the full view keeps the chain.
|
|
122
|
+
*/
|
|
123
|
+
function resolved(ds, uuid, name, view) {
|
|
124
|
+
const modes = { ...DEFAULT_MODES };
|
|
125
|
+
for (const k of MODE_KEYS)
|
|
126
|
+
if (typeof name?.[k] === "string") modes[k] = name[k];
|
|
127
|
+
const r = uuid && ds.resolveReference(uuid, modes);
|
|
128
|
+
if (!r || r.value === undefined) return {};
|
|
129
|
+
const out = typeof r.value === "object" ? {} : { value: r.value };
|
|
130
|
+
if (view === "full") out.chain = r.chain.filter((c) => typeof c === "string");
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const VIEW_PROP = {
|
|
135
|
+
type: "string",
|
|
136
|
+
enum: ["compact", "full"],
|
|
137
|
+
description:
|
|
138
|
+
"compact (default) adds an alias token's own resolved value (in its own mode; default modes where it is multi-mode); full also adds the alias `chain`. Composite values are not shown.",
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
let _resolver;
|
|
142
|
+
/** Dataset whose graph is keyed by uuid, so resolveReference can address one exact token. */
|
|
143
|
+
async function getResolver() {
|
|
144
|
+
if (!_resolver)
|
|
145
|
+
_resolver = loadDataset(
|
|
146
|
+
config.cascadeActive ? config.cascadeDataPath : config.dataPath,
|
|
147
|
+
);
|
|
148
|
+
return _resolver;
|
|
149
|
+
}
|
|
150
|
+
|
|
111
151
|
export function createReadTools() {
|
|
112
152
|
return [
|
|
113
153
|
{
|
|
@@ -263,7 +303,7 @@ export function createReadTools() {
|
|
|
263
303
|
{
|
|
264
304
|
name: "query_tokens",
|
|
265
305
|
description:
|
|
266
|
-
"Query design tokens using a filter expression. Returns matching token entries.",
|
|
306
|
+
"Query design tokens using a filter expression. Returns matching token entries; alias tokens add `value` (the token's own resolved value in its own mode), and `chain` with view=full.",
|
|
267
307
|
inputSchema: {
|
|
268
308
|
type: "object",
|
|
269
309
|
required: ["filter"],
|
|
@@ -276,14 +316,21 @@ export function createReadTools() {
|
|
|
276
316
|
'uuid, $schema, tier (primitive, semantic or component), object, anatomy, colorRole. Results include purposeFields. Note: "component" is not currently populated on ' +
|
|
277
317
|
"tokens — component=<id> always returns []; use describe_component instead.",
|
|
278
318
|
},
|
|
319
|
+
view: VIEW_PROP,
|
|
279
320
|
},
|
|
280
321
|
additionalProperties: false,
|
|
281
322
|
},
|
|
282
|
-
async handler({ filter }) {
|
|
323
|
+
async handler({ filter, view = "compact" }) {
|
|
283
324
|
const ds = await loadDataset(
|
|
284
325
|
config.cascadeActive ? config.cascadeDataPath : config.dataPath,
|
|
285
326
|
);
|
|
286
|
-
return ds.query(filter)
|
|
327
|
+
return ds.query(filter).map(({ schemaUrl, raw, ...t }) => {
|
|
328
|
+
const { $schema, uuid, ...rest } = raw;
|
|
329
|
+
const slim = { ...t, raw: rest };
|
|
330
|
+
return t.aliasTarget
|
|
331
|
+
? { ...slim, ...resolved(ds, t.uuid, raw.name, view) }
|
|
332
|
+
: slim;
|
|
333
|
+
});
|
|
287
334
|
},
|
|
288
335
|
},
|
|
289
336
|
|
|
@@ -308,12 +355,17 @@ export function createReadTools() {
|
|
|
308
355
|
description: "Maximum number of suggestions to return (default: 5)",
|
|
309
356
|
default: 5,
|
|
310
357
|
},
|
|
358
|
+
view: VIEW_PROP,
|
|
311
359
|
},
|
|
312
360
|
additionalProperties: false,
|
|
313
361
|
},
|
|
314
|
-
async handler({ intent, limit = 5 }) {
|
|
362
|
+
async handler({ intent, limit = 5, view = "compact" }) {
|
|
315
363
|
const ds = await getDataset();
|
|
316
|
-
|
|
364
|
+
const resolver = await getResolver();
|
|
365
|
+
return ds.suggest(intent, undefined, limit).map(({ file, ...s }) => ({
|
|
366
|
+
...s,
|
|
367
|
+
...resolved(resolver, s.tokenUuid, s.nameObject, view),
|
|
368
|
+
}));
|
|
317
369
|
},
|
|
318
370
|
},
|
|
319
371
|
|