@adobe/design-data-agent-mcp 1.11.0 → 1.12.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/package.json +3 -3
- package/skills/design-data/SKILL.md +17 -6
- package/src/tools/read.js +71 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-agent-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.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",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
33
|
-
"@adobe/design-data": "3.2.
|
|
34
|
-
"@adobe/design-data-wasm": "0.
|
|
33
|
+
"@adobe/design-data": "3.2.1",
|
|
34
|
+
"@adobe/design-data-wasm": "0.10.0",
|
|
35
35
|
"@adobe/spectrum-design-data": "3.2.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -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.12.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,
|
|
@@ -67,9 +67,18 @@ all subsequent lookups. No inputs required.
|
|
|
67
67
|
|
|
68
68
|
### Resolve a token to its literal value — `resolve_token`
|
|
69
69
|
|
|
70
|
-
Required: `property` (string) — e.g. `"
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
Required: `property` (string) — the bare `name.property` segment, e.g. `"background-color"`
|
|
71
|
+
or `"corner-radius"` (see `primer().properties` for the full list). **Not** a flattened
|
|
72
|
+
legacyKey like `"accent-background-color-default"` — that form never resolves.
|
|
73
|
+
Optional context: `colorScheme` (`"light"` or `"dark"`), `scale` (`"desktop"` or `"mobile"`),
|
|
74
|
+
`contrast` (`"regular"` or `"high"`). Optional narrowing: `component`, `variant`, `state`, and
|
|
75
|
+
`colorRole`. Set `excludeDeprecated` to omit tokens with `lifecycle.deprecatedIn`.
|
|
76
|
+
|
|
77
|
+
> **Gotcha:** when several tokens share a property, use `variant`, `state`, or `colorRole` to
|
|
78
|
+
> narrow the match, then check `ambiguous` and `deprecated` on the result. `component` is
|
|
79
|
+
> sparsely populated in the current dataset, so prefer the other fields when available.
|
|
80
|
+
> `resolve_token` still uses cascade ranking when multiple candidates remain; use `query_tokens`
|
|
81
|
+
> to inspect the full candidate set.
|
|
73
82
|
|
|
74
83
|
### Query tokens by filter expression — `query_tokens`
|
|
75
84
|
|
|
@@ -83,12 +92,14 @@ Filter syntax examples:
|
|
|
83
92
|
```
|
|
84
93
|
property=background-color
|
|
85
94
|
property=*background*
|
|
86
|
-
component=button
|
|
87
|
-
component=button,state=hover
|
|
88
95
|
property=background-color|property=border-color
|
|
89
96
|
$schema=https://spectrum.adobe.com/page/design-token/
|
|
90
97
|
```
|
|
91
98
|
|
|
99
|
+
> **Gotcha:** `component=<id>` currently always returns `[]` — tokens aren't
|
|
100
|
+
> component-indexed in this dataset. Use `describe_component` to see a component's known
|
|
101
|
+
> token bindings instead.
|
|
102
|
+
|
|
92
103
|
> **Exit codes:** `0` = matches found; empty array = no matches (not an error).
|
|
93
104
|
|
|
94
105
|
***
|
package/src/tools/read.js
CHANGED
|
@@ -121,16 +121,16 @@ export function createReadTools() {
|
|
|
121
121
|
async handler() {
|
|
122
122
|
// Shape note: this response intentionally diverges from the CLI PrimerData
|
|
123
123
|
// struct (sdk/core/src/primer.rs). The CLI emits modeSets as an array of
|
|
124
|
-
// {name,
|
|
125
|
-
// shape uses keyed objects (matching the sibling design-data-mcp),
|
|
126
|
-
// and the SKILL.md skill prompt consume by key name. Skill
|
|
127
|
-
// tokenCount, modeSets.{colorScheme,scale,contrast}, components[],
|
|
124
|
+
// {name, modes, defaultMode} objects and taxonomyFields as a flat array. This
|
|
125
|
+
// in-process shape uses keyed objects (matching the sibling design-data-mcp),
|
|
126
|
+
// which agents and the SKILL.md skill prompt consume by key name. Skill
|
|
127
|
+
// contract: tokenCount, modeSets.{colorScheme,scale,contrast}, components[],
|
|
128
128
|
// taxonomyFields.{indexed,advisory}. provenance is included for metrics:
|
|
129
129
|
// for the embedded dataset it carries designDataVersion (@adobe/spectrum-design-data
|
|
130
130
|
// version baked in at wasm build time); for custom datasets the source differs.
|
|
131
131
|
const wasm = await getWasm();
|
|
132
132
|
const ds = await getDataset();
|
|
133
|
-
const { provenance } = ds.primer();
|
|
133
|
+
const { provenance, modeSets: rawModeSets } = ds.primer();
|
|
134
134
|
// Best-effort staleness check (spectrum-design-data-9fe.5) — silent on
|
|
135
135
|
// failure, never blocks the primer response.
|
|
136
136
|
const datasetStatus = await checkDatasetFreshness(
|
|
@@ -142,11 +142,13 @@ export function createReadTools() {
|
|
|
142
142
|
// and consumers should prefer it going forward.
|
|
143
143
|
source: config.cascadeActive ? "cascade" : "embedded",
|
|
144
144
|
tokenCount: ds.tokenCount(),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
// Mode-set dimensions (colorScheme, scale, contrast) live in
|
|
146
|
+
// graph.mode_sets, not the field-catalog registry, so they're read from
|
|
147
|
+
// ds.primer()'s modeSets array rather than wasm.getFieldValues()
|
|
148
|
+
// (spectrum-design-data-v9bb).
|
|
149
|
+
modeSets: Object.fromEntries(
|
|
150
|
+
rawModeSets.map((ms) => [ms.name, ms.modes]),
|
|
151
|
+
),
|
|
150
152
|
taxonomyFields: {
|
|
151
153
|
indexed: wasm.getIndexedFields(),
|
|
152
154
|
advisory: wasm.getAdvisoryFields() ?? [],
|
|
@@ -163,7 +165,9 @@ export function createReadTools() {
|
|
|
163
165
|
{
|
|
164
166
|
name: "resolve_token",
|
|
165
167
|
description:
|
|
166
|
-
"Resolve a design token property to its final value for a given
|
|
168
|
+
"Resolve a design token property to its final value for a given context. " +
|
|
169
|
+
"Use component, variant, state, or colorRole to disambiguate shared properties; " +
|
|
170
|
+
"inspect ambiguous and deprecated in the result.",
|
|
167
171
|
inputSchema: {
|
|
168
172
|
type: "object",
|
|
169
173
|
required: ["property"],
|
|
@@ -171,7 +175,9 @@ export function createReadTools() {
|
|
|
171
175
|
property: {
|
|
172
176
|
type: "string",
|
|
173
177
|
description:
|
|
174
|
-
"
|
|
178
|
+
"Bare token property name (the name.property segment, e.g. " +
|
|
179
|
+
'"background-color", "corner-radius" — see primer().properties for ' +
|
|
180
|
+
"the full list). Not a flattened legacyKey.",
|
|
175
181
|
},
|
|
176
182
|
colorScheme: {
|
|
177
183
|
type: "string",
|
|
@@ -187,10 +193,46 @@ export function createReadTools() {
|
|
|
187
193
|
enum: ["regular", "high"],
|
|
188
194
|
description: "Contrast: regular or high",
|
|
189
195
|
},
|
|
196
|
+
component: {
|
|
197
|
+
type: "string",
|
|
198
|
+
description:
|
|
199
|
+
"Optional component name-object field. It is sparsely populated; " +
|
|
200
|
+
"prefer variant, state, or colorRole when available.",
|
|
201
|
+
},
|
|
202
|
+
variant: {
|
|
203
|
+
type: "string",
|
|
204
|
+
description:
|
|
205
|
+
"Optional token variant used to narrow shared properties.",
|
|
206
|
+
},
|
|
207
|
+
state: {
|
|
208
|
+
type: "string",
|
|
209
|
+
description:
|
|
210
|
+
"Optional token state used to narrow shared properties (including array-valued state).",
|
|
211
|
+
},
|
|
212
|
+
colorRole: {
|
|
213
|
+
type: "string",
|
|
214
|
+
description:
|
|
215
|
+
"Optional color role such as accent, negative, or positive.",
|
|
216
|
+
},
|
|
217
|
+
excludeDeprecated: {
|
|
218
|
+
type: "boolean",
|
|
219
|
+
description:
|
|
220
|
+
"Exclude tokens with lifecycle.deprecatedIn from candidate resolution.",
|
|
221
|
+
},
|
|
190
222
|
},
|
|
191
223
|
additionalProperties: false,
|
|
192
224
|
},
|
|
193
|
-
async handler({
|
|
225
|
+
async handler({
|
|
226
|
+
property,
|
|
227
|
+
colorScheme,
|
|
228
|
+
scale,
|
|
229
|
+
contrast,
|
|
230
|
+
component,
|
|
231
|
+
variant,
|
|
232
|
+
state,
|
|
233
|
+
colorRole,
|
|
234
|
+
excludeDeprecated,
|
|
235
|
+
}) {
|
|
194
236
|
const ds = await loadDataset(
|
|
195
237
|
config.cascadeActive ? config.cascadeDataPath : config.dataPath,
|
|
196
238
|
);
|
|
@@ -198,10 +240,19 @@ export function createReadTools() {
|
|
|
198
240
|
if (colorScheme) context.colorScheme = colorScheme;
|
|
199
241
|
if (scale) context.scale = scale;
|
|
200
242
|
if (contrast) context.contrast = contrast;
|
|
201
|
-
const result = ds.resolve(property, context
|
|
243
|
+
const result = ds.resolve(property, context, {
|
|
244
|
+
component,
|
|
245
|
+
variant,
|
|
246
|
+
state,
|
|
247
|
+
colorRole,
|
|
248
|
+
excludeDeprecated: excludeDeprecated ?? false,
|
|
249
|
+
});
|
|
202
250
|
if (!result) {
|
|
251
|
+
const deprecatedHint = excludeDeprecated
|
|
252
|
+
? " Only deprecated matches may exist; retry without excludeDeprecated to inspect them."
|
|
253
|
+
: "";
|
|
203
254
|
throw new Error(
|
|
204
|
-
`No token found for property "${property}" in context ${JSON.stringify(context)}`,
|
|
255
|
+
`No token found for property "${property}" in context ${JSON.stringify(context)}.${deprecatedHint}`,
|
|
205
256
|
);
|
|
206
257
|
}
|
|
207
258
|
return result;
|
|
@@ -218,7 +269,11 @@ export function createReadTools() {
|
|
|
218
269
|
properties: {
|
|
219
270
|
filter: {
|
|
220
271
|
type: "string",
|
|
221
|
-
description:
|
|
272
|
+
description:
|
|
273
|
+
'Filter expression, e.g. "property=background-color". Valid keys: ' +
|
|
274
|
+
"property, component, variant, state, colorScheme, scale, contrast, " +
|
|
275
|
+
'uuid, $schema. Note: "component" is not currently populated on ' +
|
|
276
|
+
"tokens — component=<id> always returns []; use describe_component instead.",
|
|
222
277
|
},
|
|
223
278
|
},
|
|
224
279
|
additionalProperties: false,
|