@respira/wordpress-mcp-server 8.3.22 → 8.3.23

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to Respira WordPress MCP Server will be documented in this f
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [8.3.23] - 2026-09-11
9
+
10
+ ### Fixed
11
+
12
+ - **`apply_builder_patch` accepts `find_element`'s identifier shapes.** The tool now
13
+ documents and accepts `{ type: "id" | "path" | "admin_label", value }` and
14
+ `{ identifier_type, identifier_value }` next to the existing `{ id | path | admin_label |
15
+ type }`, and rewrites them before sending, so they also work against older plugins for
16
+ path, admin_label and module type. Resolving a Divi 5 element id needs plugin 8.8.35.
17
+
8
18
  ## [8.3.22] - 2026-09-11
9
19
 
10
20
  Writes that reach the site, or say plainly why they did not.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=9dee06c4-patch-identifier-vocabulary.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"9dee06c4-patch-identifier-vocabulary.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/9dee06c4-patch-identifier-vocabulary.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Ticket 9dee06c4 (Nathan, n2workspaces.com, Divi 5.10.1, plugin 8.8.20):
3
+ * "apply-builder-patch cannot resolve that target by {"type":"id"} or
4
+ * {"type":"path"} (respira_patch_target_not_found) while find-element
5
+ * resolves both."
6
+ *
7
+ * respira_find_element takes identifier_type + identifier_value. A patch
8
+ * identifier is an object keyed by what you know ({ id }, { path }), where
9
+ * `type` means the MODULE type. The agent carried find_element's words over
10
+ * and sent { type: "id", value: "..." }, so the plugin searched for a module of
11
+ * type "id" and found none.
12
+ *
13
+ * Two things are checked here, both the way a client meets them:
14
+ * 1. The published tool schema states the accepted shapes: `type` is the
15
+ * module type, and find_element's vocabulary (`value`, `identifier_type`,
16
+ * `identifier_value`) is listed and described.
17
+ * 2. The real WordPressClient sends that vocabulary in the canonical shape,
18
+ * so it resolves even on a plugin that predates the plugin-side fix. What
19
+ * it must NOT touch is checked too: a real module type, a value-less
20
+ * identifier, and a conflict are forwarded exactly as sent.
21
+ */
22
+ import assert from 'node:assert/strict';
23
+ import { test, after } from 'node:test';
24
+ import { resolve } from 'node:path';
25
+ import http from 'node:http';
26
+ import { Client } from '@modelcontextprotocol/client';
27
+ import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
28
+ import { WordPressClient } from '../wordpress-client.js';
29
+ const servers = [];
30
+ after(() => {
31
+ for (const server of servers)
32
+ server.close();
33
+ });
34
+ async function listen(handler) {
35
+ const server = http.createServer(handler);
36
+ servers.push(server);
37
+ await new Promise((resolveListen) => server.listen(0, '127.0.0.1', resolveListen));
38
+ return server.address().port;
39
+ }
40
+ test('9dee06c4: the published apply_builder_patch schema states the accepted identifier shapes', { timeout: 20_000 }, async () => {
41
+ const port = await listen((_request, response) => {
42
+ response.writeHead(200, { 'content-type': 'application/json' });
43
+ response.end(JSON.stringify({ wordpress_version: '6.8', page_builder: { name: 'divi', version: '5.10.1' }, active_plugins: [] }));
44
+ });
45
+ const config = Buffer.from(JSON.stringify({
46
+ sites: [{ id: 'patch-ident', name: 'Patch identifier', url: `http://127.0.0.1:${port}`, apiKey: 'respira_patch_ident', default: true }],
47
+ preferences: { autoDuplicate: true, securityChecks: true },
48
+ })).toString('base64');
49
+ const client = new Client({ name: 'respira-9dee06c4', version: '1.0.0' });
50
+ try {
51
+ await client.connect(new StdioClientTransport({
52
+ command: process.execPath,
53
+ args: [resolve(process.cwd(), 'dist/index.js')],
54
+ cwd: process.cwd(),
55
+ stderr: 'pipe',
56
+ env: { ...process.env, RESPIRA_CONFIG_B64: config, RESPIRA_USAGE_OPT_OUT: '1', NODE_ENV: 'test' },
57
+ }));
58
+ const { tools } = await client.listTools();
59
+ const tool = tools.find((candidate) => /(^|_)apply_builder_patch$/.test(candidate.name));
60
+ assert.ok(tool, 'apply_builder_patch must be published');
61
+ const identifier = tool.inputSchema.properties?.operations?.items?.properties?.identifier;
62
+ assert.equal(identifier?.type, 'object', 'operations[].identifier must be an object');
63
+ const properties = identifier.properties ?? {};
64
+ for (const canonical of ['id', 'path', 'admin_label', 'type', 'match_content']) {
65
+ assert.ok(properties[canonical], `identifier.${canonical} must still be published`);
66
+ }
67
+ for (const alias of ['value', 'identifier_type', 'identifier_value']) {
68
+ assert.equal(properties[alias]?.type, 'string', `identifier.${alias} (find_element vocabulary) must be published as a string`);
69
+ assert.ok(String(properties[alias]?.description ?? '').length > 0, `identifier.${alias} must say what it is for`);
70
+ }
71
+ assert.match(String(identifier.description), /MODULE type/, 'the identifier description must say `type` is the module type');
72
+ assert.match(String(identifier.description), /identifier_type/, 'the identifier description must name find_element\'s vocabulary');
73
+ assert.match(String(tool.description), /\{ type: "id", value: "\.\.\." \}/, 'the tool description must show the find_element shape it accepts');
74
+ assert.match(String(tool.description), /respira_patch_ambiguous_target/, 'the tool description must say a shared id is refused');
75
+ }
76
+ finally {
77
+ await client.close();
78
+ }
79
+ });
80
+ test('9dee06c4: the client sends find_element vocabulary in the canonical identifier shape', async () => {
81
+ const bodies = [];
82
+ const port = await listen((request, response) => {
83
+ const url = request.url ?? '';
84
+ if (request.method === 'GET' && url.startsWith('/wp-json/respira/v2/status')) {
85
+ response.writeHead(200, { 'content-type': 'application/json' });
86
+ response.end(JSON.stringify({ ok: true }));
87
+ return;
88
+ }
89
+ if (request.method === 'POST' && url.startsWith('/wp-json/respira/v2/builder/divi/patch/42')) {
90
+ let raw = '';
91
+ request.on('data', (chunk) => { raw += chunk; });
92
+ request.on('end', () => {
93
+ bodies.push(JSON.parse(raw));
94
+ response.writeHead(200, { 'content-type': 'application/json' });
95
+ response.end(JSON.stringify({ success: true }));
96
+ });
97
+ return;
98
+ }
99
+ response.writeHead(404, { 'content-type': 'application/json' });
100
+ response.end(JSON.stringify({ code: 'not_found' }));
101
+ });
102
+ const wp = new WordPressClient({
103
+ id: 'patch-ident',
104
+ name: 'patch-ident',
105
+ url: `http://127.0.0.1:${port}`,
106
+ apiKey: 'respira_test_key',
107
+ });
108
+ const update = { content: '<p>New</p>' };
109
+ await wp.applyBuilderPatch('divi', 42, [
110
+ { identifier: { type: 'id', value: '2c3a794b-0000-4000-8000-000000000001' }, updates: update },
111
+ { identifier: { type: 'path', value: '0.2.1.0.1.3' }, updates: update },
112
+ { identifier: { identifier_type: 'admin_label', identifier_value: 'Hero' }, updates: update },
113
+ { identifier: { identifier_type: 'type', identifier_value: 'divi/text', match_content: 'Why us' }, updates: update },
114
+ // Must reach the plugin exactly as sent.
115
+ { identifier: { type: 'divi/text', match_content: 'Why us' }, updates: update },
116
+ { identifier: { type: 'id' }, updates: update },
117
+ { identifier: { type: 'id', value: 'aaa', id: 'bbb' }, updates: update },
118
+ ]);
119
+ assert.equal(bodies.length, 1, 'exactly one patch request is sent');
120
+ const identifiers = bodies[0].operations.map((operation) => operation.identifier);
121
+ assert.deepEqual(identifiers[0], { id: '2c3a794b-0000-4000-8000-000000000001' }, '{ type: "id", value } is sent as { id }');
122
+ assert.deepEqual(identifiers[1], { path: '0.2.1.0.1.3' }, '{ type: "path", value } is sent as { path }');
123
+ assert.deepEqual(identifiers[2], { admin_label: 'Hero' }, '{ identifier_type, identifier_value } is sent as the canonical key');
124
+ assert.deepEqual(identifiers[3], { type: 'divi/text', match_content: 'Why us' }, 'identifier_type "type" becomes the module type and keeps match_content');
125
+ assert.deepEqual(identifiers[4], { type: 'divi/text', match_content: 'Why us' }, 'a real module type is untouched');
126
+ assert.deepEqual(identifiers[5], { type: 'id' }, 'an identifier with no value is untouched (the plugin explains the shape)');
127
+ assert.deepEqual(identifiers[6], { type: 'id', value: 'aaa', id: 'bbb' }, 'a conflicting identifier is untouched (the plugin refuses it)');
128
+ assert.deepEqual(bodies[0].operations[0].updates, update, 'updates are forwarded unchanged');
129
+ });
130
+ //# sourceMappingURL=9dee06c4-patch-identifier-vocabulary.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"9dee06c4-patch-identifier-vocabulary.test.js","sourceRoot":"","sources":["../../src/__tests__/9dee06c4-patch-identifier-vocabulary.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,GAAkB,EAAE,CAAC;AAClC,KAAK,CAAC,GAAG,EAAE;IACT,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,MAAM,CAAC,OAA6B;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,IAAI,OAAO,CAAO,CAAC,aAAa,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;IACzF,OAAQ,MAAM,CAAC,OAAO,EAAkB,CAAC,IAAI,CAAC;AAChD,CAAC;AAED,IAAI,CAAC,0FAA0F,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,IAAI,EAAE;IAC/H,MAAM,IAAI,GA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AAwE,CAAC,CAAC;IAC3J,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,iCAAiC,CAAC,CAAC;IACpH,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,0EAA0E,CAAC,CAAC;IAC7H,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,+DAA+D,CAAC,CAAC;IAC3I,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,iCAAiC,CAAC,CAAC;AAC/F,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Rewrite one patch identifier from find_element's vocabulary to the canonical key. */
2
+ export declare function normalizePatchIdentifier(identifier: unknown): unknown;
3
+ /** Apply normalizePatchIdentifier to every operation's identifier. */
4
+ export declare function normalizePatchOperations<T>(operations: T): T;
5
+ //# sourceMappingURL=patch-identifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-identifier.d.ts","sourceRoot":"","sources":["../src/patch-identifier.ts"],"names":[],"mappings":"AAoCA,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAyCrE;AAED,sEAAsE;AACtE,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAU5D"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Ticket 9dee06c4 (Divi 5.10.1): an agent that had just resolved an element
3
+ * with respira_find_element (`identifier_type` + `identifier_value`) carried
4
+ * those words into respira_apply_builder_patch and sent
5
+ * `{ type: "id", value: "2c3a794b-..." }` and `{ type: "path", value: "0.2.1.0.1.3" }`.
6
+ * In a patch identifier `type` is the MODULE type, so the plugin searched for a
7
+ * module of type "id" and answered respira_patch_target_not_found.
8
+ *
9
+ * The plugin now reads that vocabulary itself (Respira_Builder_Patcher::
10
+ * normalize_identifier). This does the same rewrite before the request leaves,
11
+ * so the shapes the tool schema advertises also work against plugin versions
12
+ * that predate the fix. Keep the word list in step with
13
+ * Respira_Builder_Patcher::FIND_ELEMENT_IDENTIFIER_TYPES.
14
+ *
15
+ * Deliberately conservative: an identifier is only rewritten when the value is
16
+ * present and the canonical key is not already set. Anything else is sent as
17
+ * is, and the plugin decides (including refusing a conflict).
18
+ */
19
+ const FIND_ELEMENT_IDENTIFIER_TYPES = {
20
+ id: 'id',
21
+ path: 'path',
22
+ admin_label: 'admin_label',
23
+ type: 'type',
24
+ widget_type: 'type',
25
+ class: 'class',
26
+ content: 'content',
27
+ text: 'text',
28
+ uncode_shortcode_id: 'uncode_shortcode_id',
29
+ };
30
+ function isPlainObject(value) {
31
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
32
+ }
33
+ /** Rewrite one patch identifier from find_element's vocabulary to the canonical key. */
34
+ export function normalizePatchIdentifier(identifier) {
35
+ if (!isPlainObject(identifier)) {
36
+ return identifier;
37
+ }
38
+ let word;
39
+ let value;
40
+ let drop;
41
+ if (typeof identifier.identifier_type === 'string' && 'identifier_value' in identifier) {
42
+ word = identifier.identifier_type;
43
+ value = identifier.identifier_value;
44
+ drop = ['identifier_type', 'identifier_value'];
45
+ }
46
+ else if (typeof identifier.type === 'string' && 'value' in identifier) {
47
+ word = identifier.type;
48
+ value = identifier.value;
49
+ drop = ['type', 'value'];
50
+ }
51
+ else {
52
+ return identifier;
53
+ }
54
+ const key = FIND_ELEMENT_IDENTIFIER_TYPES[String(word).trim().toLowerCase()];
55
+ if (!key) {
56
+ return identifier;
57
+ }
58
+ if (typeof value !== 'string' && typeof value !== 'number') {
59
+ return identifier;
60
+ }
61
+ const text = String(value).trim();
62
+ if (text === '') {
63
+ return identifier;
64
+ }
65
+ const out = { ...identifier };
66
+ for (const name of drop) {
67
+ delete out[name];
68
+ }
69
+ if (key in out) {
70
+ return identifier;
71
+ }
72
+ out[key] = text;
73
+ return out;
74
+ }
75
+ /** Apply normalizePatchIdentifier to every operation's identifier. */
76
+ export function normalizePatchOperations(operations) {
77
+ if (!Array.isArray(operations)) {
78
+ return operations;
79
+ }
80
+ return operations.map((operation) => {
81
+ if (!isPlainObject(operation) || !('identifier' in operation)) {
82
+ return operation;
83
+ }
84
+ return { ...operation, identifier: normalizePatchIdentifier(operation.identifier) };
85
+ });
86
+ }
87
+ //# sourceMappingURL=patch-identifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-identifier.js","sourceRoot":"","sources":["../src/patch-identifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,6BAA6B,GAA2B;IAC5D,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,mBAAmB,EAAE,qBAAqB;CAC3C,CAAC;AAIF,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,wBAAwB,CAAC,UAAmB;IAC1D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,IAAa,CAAC;IAClB,IAAI,KAAc,CAAC;IACnB,IAAI,IAAc,CAAC;IACnB,IAAI,OAAO,U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AuCT,gBAAgB;IAmgD9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAsgBzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkWxB,GAAG;CA+CV"}
package/dist/server.js CHANGED
@@ -4397,7 +4397,7 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
4397
4397
  },
4398
4398
  {
4399
4399
  name: 'wordpress_apply_builder_patch',
4400
- description: 'Apply a list of targeted builder patch operations. Each operation is { identifier: { id|admin_label|path|type [+match_content] }, updates: { content?, attributes?, ...flat_settings? } }. The identifier block follows the same shape as wordpress_find_element\'s identifier; the updates block follows the same shape as wordpress_update_module\'s updates. Returns 400 respira_patch_invalid_operation when an entry is missing either field. This is NOT a JSON-Patch document — do not pass { op, path, value } shapes (those will be rejected). Example: { operations: [{ identifier: { admin_label: "Hero" }, updates: { admin_label: "Hero Content" } }] }.',
4400
+ description: 'Apply a list of targeted builder patch operations. Each operation is { identifier: { id|admin_label|path|type [+match_content] }, updates: { content?, attributes?, ...flat_settings? } }. The identifier is keyed by what you know: { id: "2c3a794b-..." } (a Divi 5 _nodeId, Elementor or Bricks id), { path: "0.2.1" } (the path_string wordpress_find_element returns), { admin_label: "Hero" }, or { type: "divi/text", match_content: "text inside it" }. In the identifier, `type` is the MODULE type, never the kind of identifier. wordpress_find_element\'s vocabulary is also accepted when the value is present: { identifier_type: "id", identifier_value: "..." } and { type: "id", value: "..." } (type one of id, path, admin_label, class, content, text) are read as { id: "..." }. class, content and text resolve only on Divi 4 shortcode pages; elsewhere they are refused with a 400, so look the element up with wordpress_find_element and send its path_string as { path }. An id shared by several elements (duplicated modules keep their id) is refused with respira_patch_ambiguous_target and the candidate paths. The updates block follows the same shape as wordpress_update_module\'s updates. Returns 400 respira_patch_invalid_operation when an entry is missing either field. This is NOT a JSON-Patch document — do not pass { op, path, value } shapes (those will be rejected). Example: { operations: [{ identifier: { admin_label: "Hero" }, updates: { admin_label: "Hero Content" } }] }.',
4401
4401
  inputSchema: {
4402
4402
  type: 'object',
4403
4403
  properties: {
@@ -4422,13 +4422,16 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
4422
4422
  properties: {
4423
4423
  identifier: {
4424
4424
  type: 'object',
4425
- description: 'Element identifier. Provide exactly one of id / admin_label / path / type. match_content disambiguates duplicates of the same type. `path` accepts both dialects: the index form respira_find_element emits ("1.0.1") and the key-interleaved form ("1.children.0.children.1"). They name the same element.',
4425
+ description: 'Element identifier. Provide exactly one of id / admin_label / path / type. match_content disambiguates duplicates of the same type. `path` accepts both dialects: the index form respira_find_element emits ("1.0.1") and the key-interleaved form ("1.children.0.children.1"). They name the same element. `type` is the MODULE type ("divi/text"), never the kind of identifier. wordpress_find_element\'s vocabulary is also read: { identifier_type: "id", identifier_value: "..." } or { type: "id", value: "..." } becomes { id: "..." } (type one of id, path, admin_label, class, content, text; value required). Prefer the canonical keys.',
4426
4426
  properties: {
4427
- id: { type: 'string', description: 'Builder element ID (Divi 5 _nodeId, Elementor element id, Bricks id, etc).' },
4427
+ id: { type: 'string', description: 'Builder element ID (Divi 5 _nodeId, Elementor element id, Bricks id, etc). An id shared by several elements (duplicated modules) is refused with the candidate paths; send one of them as path.' },
4428
4428
  admin_label: { type: 'string', description: 'Admin label / navigator label.' },
4429
4429
  path: { description: 'Index path as either a dot-string "0.1.2" or an array [0,1,2].' },
4430
- type: { type: 'string', description: 'Module type (e.g. "divi/heading", "et_pb_text", "core/paragraph").' },
4430
+ type: { type: 'string', description: 'Module type (e.g. "divi/heading", "et_pb_text", "core/paragraph"). Not the identifier kind: with a `value` next to it, type "id", "path", "admin_label", "class", "content" or "text" is read as find_element vocabulary instead.' },
4431
4431
  match_content: { type: 'string', description: 'Optional content substring for disambiguation.' },
4432
+ value: { type: 'string', description: 'find_element vocabulary: the value for a `type` of id, path, admin_label, class, content or text. { type: "path", value: "0.2.1" } is read as { path: "0.2.1" }.' },
4433
+ identifier_type: { type: 'string', description: 'find_element vocabulary: id, path, admin_label, type, class, content or text. Read together with identifier_value, e.g. { identifier_type: "id", identifier_value: "2c3a794b-..." } is read as { id: "2c3a794b-..." }.' },
4434
+ identifier_value: { type: 'string', description: 'find_element vocabulary: the value for identifier_type.' },
4432
4435
  },
4433
4436
  },
4434
4437
  updates: {