@wootsup/mcp 0.3.0 → 0.4.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/CHANGELOG.md +14 -5
- package/dist/catalog/build-catalog.d.ts +31 -0
- package/dist/catalog/build-catalog.js +68 -0
- package/dist/catalog/build-catalog.js.map +1 -0
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/dist/modules/apimapper/auto-layout.d.ts +21 -0
- package/dist/modules/apimapper/auto-layout.js +54 -0
- package/dist/modules/apimapper/auto-layout.js.map +1 -0
- package/dist/modules/apimapper/client.d.ts +54 -4
- package/dist/modules/apimapper/client.js +145 -14
- package/dist/modules/apimapper/client.js.map +1 -1
- package/dist/modules/apimapper/connections-format.d.ts +31 -1
- package/dist/modules/apimapper/connections-format.js +97 -5
- package/dist/modules/apimapper/connections-format.js.map +1 -1
- package/dist/modules/apimapper/connections.d.ts +9 -7
- package/dist/modules/apimapper/connections.js +225 -58
- package/dist/modules/apimapper/connections.js.map +1 -1
- package/dist/modules/apimapper/credentials.js +86 -14
- package/dist/modules/apimapper/credentials.js.map +1 -1
- package/dist/modules/apimapper/elicitation.d.ts +29 -0
- package/dist/modules/apimapper/elicitation.js +62 -0
- package/dist/modules/apimapper/elicitation.js.map +1 -1
- package/dist/modules/apimapper/example-extract.d.ts +13 -0
- package/dist/modules/apimapper/example-extract.js +111 -0
- package/dist/modules/apimapper/example-extract.js.map +1 -0
- package/dist/modules/apimapper/filter-operators.d.ts +24 -0
- package/dist/modules/apimapper/filter-operators.js +103 -0
- package/dist/modules/apimapper/filter-operators.js.map +1 -0
- package/dist/modules/apimapper/flows-format.js +92 -22
- package/dist/modules/apimapper/flows-format.js.map +1 -1
- package/dist/modules/apimapper/flows.d.ts +8 -7
- package/dist/modules/apimapper/flows.js +216 -44
- package/dist/modules/apimapper/flows.js.map +1 -1
- package/dist/modules/apimapper/gateway/advanced-read-tool.d.ts +9 -0
- package/dist/modules/apimapper/gateway/advanced-read-tool.js +172 -0
- package/dist/modules/apimapper/gateway/advanced-read-tool.js.map +1 -0
- package/dist/modules/apimapper/gateway/advanced-tool.js +39 -130
- package/dist/modules/apimapper/gateway/advanced-tool.js.map +1 -1
- package/dist/modules/apimapper/gateway/collect-module-tools.d.ts +17 -0
- package/dist/modules/apimapper/gateway/collect-module-tools.js +44 -0
- package/dist/modules/apimapper/gateway/collect-module-tools.js.map +1 -0
- package/dist/modules/apimapper/gateway/essentials.d.ts +1 -1
- package/dist/modules/apimapper/gateway/essentials.js +19 -7
- package/dist/modules/apimapper/gateway/essentials.js.map +1 -1
- package/dist/modules/apimapper/gateway/gateway-shared.d.ts +21 -0
- package/dist/modules/apimapper/gateway/gateway-shared.js +124 -0
- package/dist/modules/apimapper/gateway/gateway-shared.js.map +1 -0
- package/dist/modules/apimapper/gateway/test-support.d.ts +1 -17
- package/dist/modules/apimapper/gateway/test-support.js +4 -33
- package/dist/modules/apimapper/gateway/test-support.js.map +1 -1
- package/dist/modules/apimapper/get-skill-cores.d.ts +4 -0
- package/dist/modules/apimapper/get-skill-cores.js +220 -0
- package/dist/modules/apimapper/get-skill-cores.js.map +1 -0
- package/dist/modules/apimapper/get-skill.d.ts +1 -1
- package/dist/modules/apimapper/get-skill.js +30 -3
- package/dist/modules/apimapper/get-skill.js.map +1 -1
- package/dist/modules/apimapper/graph-builder.d.ts +85 -2
- package/dist/modules/apimapper/graph-builder.js +151 -15
- package/dist/modules/apimapper/graph-builder.js.map +1 -1
- package/dist/modules/apimapper/graph.js +115 -15
- package/dist/modules/apimapper/graph.js.map +1 -1
- package/dist/modules/apimapper/index.js +25 -13
- package/dist/modules/apimapper/index.js.map +1 -1
- package/dist/modules/apimapper/jmespath-test.d.ts +4 -0
- package/dist/modules/apimapper/jmespath-test.js +152 -0
- package/dist/modules/apimapper/jmespath-test.js.map +1 -0
- package/dist/modules/apimapper/library.js +131 -8
- package/dist/modules/apimapper/library.js.map +1 -1
- package/dist/modules/apimapper/list-footer.d.ts +27 -0
- package/dist/modules/apimapper/list-footer.js +57 -0
- package/dist/modules/apimapper/list-footer.js.map +1 -0
- package/dist/modules/apimapper/local-sources.js +88 -31
- package/dist/modules/apimapper/local-sources.js.map +1 -1
- package/dist/modules/apimapper/mcp-client-identity.d.ts +32 -0
- package/dist/modules/apimapper/mcp-client-identity.js +70 -0
- package/dist/modules/apimapper/mcp-client-identity.js.map +1 -0
- package/dist/modules/apimapper/merge-constants.d.ts +6 -0
- package/dist/modules/apimapper/merge-constants.js +26 -0
- package/dist/modules/apimapper/merge-constants.js.map +1 -0
- package/dist/modules/apimapper/node-schema.d.ts +52 -2
- package/dist/modules/apimapper/node-schema.js +95 -4
- package/dist/modules/apimapper/node-schema.js.map +1 -1
- package/dist/modules/apimapper/onboarding.d.ts +29 -0
- package/dist/modules/apimapper/onboarding.js +117 -9
- package/dist/modules/apimapper/onboarding.js.map +1 -1
- package/dist/modules/apimapper/read-cache.d.ts +16 -3
- package/dist/modules/apimapper/read-cache.js +59 -4
- package/dist/modules/apimapper/read-cache.js.map +1 -1
- package/dist/modules/apimapper/render/index.js +26 -5
- package/dist/modules/apimapper/render/index.js.map +1 -1
- package/dist/modules/apimapper/resource-id.d.ts +13 -0
- package/dist/modules/apimapper/resource-id.js +69 -0
- package/dist/modules/apimapper/resource-id.js.map +1 -0
- package/dist/modules/apimapper/tool-result.d.ts +20 -0
- package/dist/modules/apimapper/tool-result.js +67 -5
- package/dist/modules/apimapper/tool-result.js.map +1 -1
- package/dist/modules/apimapper/toolslist-size.d.ts +10 -10
- package/dist/modules/apimapper/toolslist-size.js +29 -18
- package/dist/modules/apimapper/toolslist-size.js.map +1 -1
- package/dist/modules/apimapper/types.d.ts +13 -0
- package/dist/modules/apimapper/types.js +1 -1
- package/dist/modules/apimapper/types.js.map +1 -1
- package/dist/modules/apimapper/whitelist-drift.js +16 -1
- package/dist/modules/apimapper/whitelist-drift.js.map +1 -1
- package/dist/modules/apimapper/workflows.js +221 -32
- package/dist/modules/apimapper/workflows.js.map +1 -1
- package/dist/modules/apimapper/yootheme-binding.js +103 -22
- package/dist/modules/apimapper/yootheme-binding.js.map +1 -1
- package/dist/platform/index.js +7 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/proxy/bridge.d.ts +35 -0
- package/dist/proxy/bridge.js +129 -0
- package/dist/proxy/bridge.js.map +1 -0
- package/dist/proxy/mode.d.ts +9 -0
- package/dist/proxy/mode.js +20 -0
- package/dist/proxy/mode.js.map +1 -0
- package/dist/setup/probe-auth.d.ts +51 -0
- package/dist/setup/probe-auth.js +141 -0
- package/dist/setup/probe-auth.js.map +1 -0
- package/dist/setup-cli.d.ts +9 -0
- package/dist/setup-cli.js +34 -0
- package/dist/setup-cli.js.map +1 -1
- package/dist/sites/loader.d.ts +7 -0
- package/dist/sites/loader.js +16 -1
- package/dist/sites/loader.js.map +1 -1
- package/dist/skill-instructions.d.ts +14 -1
- package/dist/skill-instructions.js +30 -6
- package/dist/skill-instructions.js.map +1 -1
- package/manifest.json +2 -2
- package/package.json +3 -2
- package/skills/apimapper/SKILL.md +78 -3
- package/skills/apimapper/reference/dynamize-existing-layout.md +158 -0
- package/skills/apimapper/reference/jmespath-cookbook.md +241 -0
- package/skills/apimapper/reference/jmespath-pitfalls.md +81 -0
- package/skills/apimapper/reference/library-template-discovery.md +1 -1
- package/skills/apimapper/reference/merge-two-sources-on-key.md +117 -12
- package/skills/apimapper/reference/oauth.md +143 -52
- package/skills/apimapper/reference/troubleshooting.md +2 -2
- package/skills/apimapper/reference/yootheme-source-to-builder-handoff.md +348 -0
- package/skills/apimapper/reference/yootheme.md +75 -44
|
@@ -143,19 +143,74 @@ export function setCached(method, url, data, opts) {
|
|
|
143
143
|
storedAt: now,
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Cross-family invalidation map (A19, mcp-cold-readiness-audit 2026-06-10).
|
|
148
|
+
*
|
|
149
|
+
* Some mutations affect a DIFFERENT resource family than the path they POST
|
|
150
|
+
* to. The path-overlap matcher below only handles same-family + ancestor/
|
|
151
|
+
* descendant invalidation; it cannot know that completing an OAuth flow
|
|
152
|
+
* mutates credential STATUS. Each entry maps a mutation-path prefix to the
|
|
153
|
+
* extra read-family path(s) that must also be flushed.
|
|
154
|
+
*
|
|
155
|
+
* `/oauth` → `/credentials`: oauth_authorize_begin (and the consent callback)
|
|
156
|
+
* refresh a credential's token; without this, a cached GET /credentials keeps
|
|
157
|
+
* serving the pre-authorize "expired" status for the full TTL and the agent
|
|
158
|
+
* re-suggests a reconnect it already completed.
|
|
159
|
+
*/
|
|
160
|
+
const CROSS_FAMILY_INVALIDATION = [
|
|
161
|
+
{ when: "/oauth", also: ["/credentials"] },
|
|
162
|
+
];
|
|
146
163
|
/**
|
|
147
164
|
* Invalidate cache entries whose request path overlaps with the mutated
|
|
148
|
-
* resource. Conservative — clears every entry whose
|
|
149
|
-
*
|
|
150
|
-
* `/flows`, `/flows?status
|
|
165
|
+
* resource — in BOTH directions. Conservative — clears every entry whose
|
|
166
|
+
* cached path contains the mutation path (descendants + query variants,
|
|
167
|
+
* e.g. invalidateByPath('/flows') clears `/flows`, `/flows?status=…`,
|
|
168
|
+
* `/flows/abc123`) AND every entry whose cached path is an ancestor of
|
|
169
|
+
* the mutation path (e.g. POST `/flows/abc/detect-schema` flushes the
|
|
170
|
+
* cached GET `/flows/abc` and `/flows`).
|
|
171
|
+
*
|
|
172
|
+
* The ancestor direction is load-bearing: 2026-06-09 Round-2 live repro —
|
|
173
|
+
* a sub-resource mutation (`/flows/{id}/detect-schema`) persisted the
|
|
174
|
+
* output schema, but the cached parent GET `/flows/{id}` kept serving the
|
|
175
|
+
* pre-schema flow for the full TTL, so binding_for_flow reported
|
|
176
|
+
* fields:[] while the data was already saved.
|
|
177
|
+
*
|
|
178
|
+
* A19: in addition, a mutation may invalidate a DIFFERENT resource family
|
|
179
|
+
* (see CROSS_FAMILY_INVALIDATION) — e.g. an /oauth mutation flushes the
|
|
180
|
+
* cached /credentials list.
|
|
151
181
|
*
|
|
152
182
|
* Called automatically from client.ts on POST/PUT/PATCH/DELETE.
|
|
153
183
|
*/
|
|
154
184
|
export function invalidateByPath(path) {
|
|
155
185
|
const needle = path.split("?")[0]; // strip query, match path only
|
|
156
186
|
for (const key of store.keys()) {
|
|
157
|
-
if (key.includes(needle))
|
|
187
|
+
if (key.includes(needle)) {
|
|
158
188
|
store.delete(key);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
// Ancestor match: the cached entry's path-part (key format
|
|
192
|
+
// `METHOD::S|R::url`) is a path-segment prefix of the mutation path.
|
|
193
|
+
const keyPath = (key.split("::")[2] ?? "").split("?")[0];
|
|
194
|
+
if (keyPath !== "" && needle.startsWith(keyPath + "/")) {
|
|
195
|
+
store.delete(key);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// A19 — cross-family: a mutation under a mapped prefix also flushes the
|
|
199
|
+
// related read-family path(s). Each `also` entry is delegated back through
|
|
200
|
+
// the same descendant/query-variant matcher so `/credentials?…` variants go
|
|
201
|
+
// too. Guarded against self-recursion (an `also` path never re-matches its
|
|
202
|
+
// own `when`).
|
|
203
|
+
for (const rule of CROSS_FAMILY_INVALIDATION) {
|
|
204
|
+
if (needle.includes(rule.when)) {
|
|
205
|
+
for (const alsoPath of rule.also) {
|
|
206
|
+
const alsoNeedle = alsoPath.split("?")[0];
|
|
207
|
+
for (const key of store.keys()) {
|
|
208
|
+
if (key.includes(alsoNeedle)) {
|
|
209
|
+
store.delete(key);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
159
214
|
}
|
|
160
215
|
}
|
|
161
216
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-cache.js","sourceRoot":"","sources":["../../../src/modules/apimapper/read-cache.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,0EAA0E;AAC1E,iFAAiF;AACjF,2EAA2E;AAC3E,+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G,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;wBAC7B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACpB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU;IACxB,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,IAAI;QACnB,KAAK,EAAE,iBAAiB;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -8,16 +8,16 @@ import { capRendered, hintFor, HARD_CAP, RESERVE } from "./token-cap.js";
|
|
|
8
8
|
// the same affordance when a renderer's Zod schema rejects the payload.
|
|
9
9
|
const RENDER_ERROR_HINTS = {
|
|
10
10
|
table: "type:'table' expects an array of objects — fetch with " +
|
|
11
|
-
|
|
11
|
+
'apimapper_connection_data or apimapper_advanced({ tool: "apimapper_graph_preview" }).',
|
|
12
12
|
"chart-bar": "type:'chart-bar' expects { labels: string[], values: number[] } of equal length.",
|
|
13
13
|
"chart-line": "type:'chart-line' expects { labels: string[], values: number[] } of equal length.",
|
|
14
14
|
"schema-diagram": "type:'schema-diagram' expects a schema profile with fields[] — " +
|
|
15
|
-
|
|
15
|
+
'fetch with apimapper_advanced({ tool: "apimapper_schema_profile" }).',
|
|
16
16
|
"flow-diagram": "type:'flow-diagram' expects a flow object with nodes[]+edges[] — " +
|
|
17
|
-
|
|
17
|
+
'fetch with apimapper_advanced({ tool: "apimapper_flow_get" }).',
|
|
18
18
|
"json-tree": "type:'json-tree' accepts any JSON value — pass the fetched payload directly.",
|
|
19
19
|
diff: "type:'diff' expects { old, new } — fetch both datasets first " +
|
|
20
|
-
|
|
20
|
+
'(e.g. two apimapper_advanced({ tool: "apimapper_schema_profile" }) calls).',
|
|
21
21
|
};
|
|
22
22
|
// MCP CallToolResult outer guard. DERIVED from token-cap.ts's HARD_CAP +
|
|
23
23
|
// RESERVE so the relationship is compiler-enforced — bumping HARD_CAP in
|
|
@@ -62,7 +62,28 @@ export function registerRenderTool(server) {
|
|
|
62
62
|
"Example:\n apimapper_render({ type: 'flow-diagram', data: flowObject })",
|
|
63
63
|
inputSchema: {
|
|
64
64
|
type: z.enum(RENDER_TYPES).describe("Visualization type"),
|
|
65
|
-
|
|
65
|
+
// MCP clients (and forwarding LLMs) frequently deliver `data` as a
|
|
66
|
+
// JSON *string* — the fetched payload gets serialised on the way in.
|
|
67
|
+
// Pre-parse a JSON string back into its value before the renderer's
|
|
68
|
+
// inner Zod schema runs, otherwise every renderer rejects the string
|
|
69
|
+
// ("table requires an array", etc.). A non-JSON string (e.g. a plain
|
|
70
|
+
// sentence) keeps its original value so it can still render as a
|
|
71
|
+
// primitive leaf. The inner schema stays z.unknown() — per-type
|
|
72
|
+
// validation lives in each renderer.
|
|
73
|
+
data: z
|
|
74
|
+
.preprocess((v) => {
|
|
75
|
+
if (typeof v !== "string")
|
|
76
|
+
return v;
|
|
77
|
+
const trimmed = v.trim();
|
|
78
|
+
try {
|
|
79
|
+
return JSON.parse(trimmed);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return v;
|
|
83
|
+
}
|
|
84
|
+
}, z.unknown())
|
|
85
|
+
.describe("Data to render. Shape depends on type — see description. " +
|
|
86
|
+
"A JSON-encoded string is auto-parsed; a plain string renders as-is."),
|
|
66
87
|
options: z.object({
|
|
67
88
|
title: z.string().max(200).optional()
|
|
68
89
|
.describe("Optional title shown above the visualization"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/apimapper/render/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzE,qEAAqE;AACrE,wEAAwE;AACxE,8EAA8E;AAC9E,wEAAwE;AACxE,MAAM,kBAAkB,GAA+B;IACrD,KAAK,EACH,wDAAwD;QACxD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/apimapper/render/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzE,qEAAqE;AACrE,wEAAwE;AACxE,8EAA8E;AAC9E,wEAAwE;AACxE,MAAM,kBAAkB,GAA+B;IACrD,KAAK,EACH,wDAAwD;QACxD,uFAAuF;IACzF,WAAW,EACT,kFAAkF;IACpF,YAAY,EACV,mFAAmF;IACrF,gBAAgB,EACd,iEAAiE;QACjE,sEAAsE;IACxE,cAAc,EACZ,mEAAmE;QACnE,gEAAgE;IAClE,WAAW,EACT,8EAA8E;IAChF,IAAI,EACF,+DAA+D;QAC/D,4EAA4E;CAC/E,CAAC;AAEF,yEAAyE;AACzE,yEAAyE;AACzE,sEAAsE;AACtE,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,4DAA4D;AAC5D,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,GAAG,GAAG,CAAC;AAEvD,MAAM,UAAU,kBAAkB,CAAC,MAAqB;IACtD,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,KAAK,EAAE,aAAa;QACpB,WAAW;QACT,iEAAiE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AAE,CAAC,CAAC;QAC1E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mEAAmE;YACnE,oEAAoE;YACpE,2DAA2D;YAC3D,iFAAiF;YACjF,MAAM,GAAG,GACP,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACvD,kEAAkE;YAClE,mEAAmE;YACnE,mEAAmE;YACnE,gCAAgC;YAChC,MAAM,OAAO,GACX,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACnD,mEAAmE;YACnE,gEAAgE;YAChE,kEAAkE;YAClE,YAAY;YACZ,OAAO,YAAY,CACjB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,EACxD,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract a Google Spreadsheet ID from a pasted URL, or return the input
|
|
3
|
+
* unchanged when it is already a bare ID (or an unrecognised value the
|
|
4
|
+
* backend should validate).
|
|
5
|
+
*
|
|
6
|
+
* Handles:
|
|
7
|
+
* - bare ID: 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
|
|
8
|
+
* - standard URL: https://docs.google.com/spreadsheets/d/{ID}/edit
|
|
9
|
+
* - URL with #gid hash: .../spreadsheets/d/{ID}/edit#gid=0
|
|
10
|
+
* - /copy, /view, etc.: .../spreadsheets/d/{ID}/copy
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractSpreadsheetId(input: string): string;
|
|
13
|
+
export declare function normalizeResourceIdFields<T extends Record<string, unknown> | undefined>(fields: T): T;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/modules/apimapper/resource-id.ts — server-bound resource-ID normalizers.
|
|
2
|
+
//
|
|
3
|
+
// A5 (2026-06-10): a cold-agent customer supplies ONLY a Google Drive / Sheets
|
|
4
|
+
// URL (the only thing they have), but the worker template placeholder
|
|
5
|
+
// {{spreadsheet_id}} needs the BARE id. The single URL→ID extractor used to
|
|
6
|
+
// live in the React admin-UI (extractResourceId.ts) and never reached the
|
|
7
|
+
// wire — so an MCP/REST caller pasting a URL produced a broken connection that
|
|
8
|
+
// returned 0 rows with no debuggable signal. We normalize on the MCP→REST
|
|
9
|
+
// boundary so the exact-as-given input works.
|
|
10
|
+
//
|
|
11
|
+
// Port of admin-ui/src/utils/extractResourceId.ts kept deliberately in
|
|
12
|
+
// lockstep — same patterns, same "return input unchanged when nothing
|
|
13
|
+
// matches" contract (the backend still validates).
|
|
14
|
+
/**
|
|
15
|
+
* Extract a Google Spreadsheet ID from a pasted URL, or return the input
|
|
16
|
+
* unchanged when it is already a bare ID (or an unrecognised value the
|
|
17
|
+
* backend should validate).
|
|
18
|
+
*
|
|
19
|
+
* Handles:
|
|
20
|
+
* - bare ID: 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
|
|
21
|
+
* - standard URL: https://docs.google.com/spreadsheets/d/{ID}/edit
|
|
22
|
+
* - URL with #gid hash: .../spreadsheets/d/{ID}/edit#gid=0
|
|
23
|
+
* - /copy, /view, etc.: .../spreadsheets/d/{ID}/copy
|
|
24
|
+
*/
|
|
25
|
+
export function extractSpreadsheetId(input) {
|
|
26
|
+
const trimmed = input.trim();
|
|
27
|
+
// Already a bare ID (alphanumeric + dash + underscore, 20+ chars).
|
|
28
|
+
if (/^[a-zA-Z0-9_-]{20,}$/.test(trimmed)) {
|
|
29
|
+
return trimmed;
|
|
30
|
+
}
|
|
31
|
+
const urlMatch = trimmed.match(/\/spreadsheets\/d\/([a-zA-Z0-9_-]+)/);
|
|
32
|
+
if (urlMatch?.[1]) {
|
|
33
|
+
return urlMatch[1];
|
|
34
|
+
}
|
|
35
|
+
// Unrecognised — return as-is, let the backend validate.
|
|
36
|
+
return trimmed;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Normalize the well-known resource-ID fields inside a template-field /
|
|
40
|
+
* extra-field map IN PLACE-safe fashion (returns a new object). Currently
|
|
41
|
+
* handles `spreadsheet_id` (Google Sheets); the table is the single place to
|
|
42
|
+
* extend for future URL-shaped resource IDs (drive_file_id, doc_id, ...).
|
|
43
|
+
*
|
|
44
|
+
* Only string values are touched; non-string values pass through verbatim so
|
|
45
|
+
* the wider string|number|boolean schema on connection_data.template_fields
|
|
46
|
+
* is preserved. Returns the input reference unchanged when there is nothing
|
|
47
|
+
* to normalize, so a default call stays byte-identical on the wire.
|
|
48
|
+
*/
|
|
49
|
+
const RESOURCE_ID_NORMALIZERS = {
|
|
50
|
+
spreadsheet_id: extractSpreadsheetId,
|
|
51
|
+
};
|
|
52
|
+
export function normalizeResourceIdFields(fields) {
|
|
53
|
+
if (!fields || typeof fields !== "object")
|
|
54
|
+
return fields;
|
|
55
|
+
let changed = false;
|
|
56
|
+
const out = { ...fields };
|
|
57
|
+
for (const [key, normalize] of Object.entries(RESOURCE_ID_NORMALIZERS)) {
|
|
58
|
+
const value = out[key];
|
|
59
|
+
if (typeof value === "string") {
|
|
60
|
+
const next = normalize(value);
|
|
61
|
+
if (next !== value) {
|
|
62
|
+
out[key] = next;
|
|
63
|
+
changed = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return (changed ? out : fields);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=resource-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-id.js","sourceRoot":"","sources":["../../../src/modules/apimapper/resource-id.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,+EAA+E;AAC/E,sEAAsE;AACtE,4EAA4E;AAC5E,0EAA0E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,IAAI,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAM,CAAC;AACvC,CAAC"}
|
|
@@ -13,6 +13,15 @@ export interface RestErrorLike {
|
|
|
13
13
|
errorCode?: ApiErrorCode | string;
|
|
14
14
|
/** HTTP status, used as the `code` fallback when `errorCode` is absent. */
|
|
15
15
|
status?: number;
|
|
16
|
+
/**
|
|
17
|
+
* F11 (2026-06-09): the parsed JSON body of a non-2xx response (the WP +
|
|
18
|
+
* Joomla platform paths thread it through as `errorBody`). When the server
|
|
19
|
+
* returns a STRUCTURED domain error — e.g. the 400 `invalid_content_type`
|
|
20
|
+
* payload `{error_code, valid_types, suggestion}` — we surface those fields
|
|
21
|
+
* VERBATIM instead of the coarse `errorCode`/`hintFor()` defaults. Absent for
|
|
22
|
+
* non-JSON errors and for the legacy paths that never set it.
|
|
23
|
+
*/
|
|
24
|
+
errorBody?: Record<string, unknown>;
|
|
16
25
|
}
|
|
17
26
|
/** Per-site overrides for the canonical REST-error mapping. */
|
|
18
27
|
export interface RestErrorOpts {
|
|
@@ -31,6 +40,17 @@ export interface RestErrorOpts {
|
|
|
31
40
|
* `response.errorCode` is absent. Use only where a site pinned a domain code.
|
|
32
41
|
*/
|
|
33
42
|
code?: string;
|
|
43
|
+
/**
|
|
44
|
+
* F6 (2026-06-09): opt-in scope-aware 403 handling. Set by tools whose 403
|
|
45
|
+
* means "your key lacks the required scope" rather than "your key is
|
|
46
|
+
* invalid" — e.g. the *_delete tools (delete needs admin scope; a valid
|
|
47
|
+
* read+write key still 403s). When true AND the response is a 403 (or the
|
|
48
|
+
* body signals insufficient scope), the suggestion becomes a scope-upgrade
|
|
49
|
+
* hint instead of the generic key-recovery walkthrough. A 401 always stays a
|
|
50
|
+
* genuine bad-key auth failure even under scopeAware. Leave unset everywhere
|
|
51
|
+
* else so non-delete tools keep the legacy auth hint byte-for-byte.
|
|
52
|
+
*/
|
|
53
|
+
scopeAware?: boolean;
|
|
34
54
|
}
|
|
35
55
|
/**
|
|
36
56
|
* Build the canonical structured error result for a failed REST request.
|
|
@@ -51,13 +51,75 @@ import { hintFor } from "./client.js";
|
|
|
51
51
|
*/
|
|
52
52
|
export function restErrorResult(response, details, opts = {}) {
|
|
53
53
|
const errorCode = response.errorCode;
|
|
54
|
+
const body = response.errorBody;
|
|
55
|
+
// F11: structured server-error passthrough. When the server attached a
|
|
56
|
+
// domain error_code (e.g. invalid_content_type), prefer it for `code`, lift
|
|
57
|
+
// its `suggestion` over the coarse hintFor(), and thread its `valid_types`
|
|
58
|
+
// (and any other primitive hint) into `details` so the agent can
|
|
59
|
+
// self-correct. Only engages when the body actually carries a string
|
|
60
|
+
// `error_code` — so a plain `{success:false, error}` body keeps the legacy
|
|
61
|
+
// path byte-for-byte.
|
|
62
|
+
const serverErrorCode = body && typeof body.error_code === "string" && body.error_code !== ""
|
|
63
|
+
? body.error_code
|
|
64
|
+
: undefined;
|
|
65
|
+
const serverSuggestion = body && typeof body.suggestion === "string" && body.suggestion !== ""
|
|
66
|
+
? body.suggestion
|
|
67
|
+
: undefined;
|
|
68
|
+
const serverValidTypes = body && Array.isArray(body.valid_types) ? body.valid_types : undefined;
|
|
69
|
+
// F6: scope-aware 403. A delete tool (scopeAware:true) that gets a 403 — or
|
|
70
|
+
// any body signalling insufficient scope — is missing the admin scope, not
|
|
71
|
+
// holding a bad key. A 401 is always a genuine bad-key failure regardless.
|
|
72
|
+
const bodyScopeSignal = body &&
|
|
73
|
+
((typeof body.error_code === "string" && /scope/i.test(body.error_code)) ||
|
|
74
|
+
(typeof body.required_scope === "string" && body.required_scope !== ""));
|
|
75
|
+
const isScopeFailure = response.status !== 401 &&
|
|
76
|
+
(opts.scopeAware === true || bodyScopeSignal === true) &&
|
|
77
|
+
(response.status === 403 || bodyScopeSignal === true);
|
|
78
|
+
// F204 — distinguish an OWNERSHIP denial from a plain missing-admin-scope
|
|
79
|
+
// denial. `insufficient_scope_ownership` means the write-scope key tried to
|
|
80
|
+
// delete a flow it did NOT create; the remedy is "delete only your own flows,
|
|
81
|
+
// or use an admin key", not just "create an admin key".
|
|
82
|
+
const isOwnershipFailure = body && typeof body.error_code === "string" && body.error_code === "insufficient_scope_ownership";
|
|
83
|
+
const scopeSuggestion = isOwnershipFailure
|
|
84
|
+
? "This write-scope key can only delete flows they created (the flow's owner " +
|
|
85
|
+
"kid must match the key's kid). This flow was created by a different key or " +
|
|
86
|
+
"via the dashboard, so it needs the admin scope. Use an admin-scope key " +
|
|
87
|
+
"(API Mapper → ⋮ menu → Settings → MCP Access → New API key, grant the admin " +
|
|
88
|
+
"scope, then re-run `npx -y @wootsup/mcp setup`), or delete it from the dashboard."
|
|
89
|
+
: isScopeFailure
|
|
90
|
+
? "Your key lacks the admin scope required for delete/destructive operations. " +
|
|
91
|
+
"Create an admin-scope key (API Mapper → ⋮ menu → Settings → MCP Access → New API key, " +
|
|
92
|
+
"grant the admin scope) and re-run `npx -y @wootsup/mcp setup`, or perform the deletion " +
|
|
93
|
+
"from the dashboard."
|
|
94
|
+
: undefined;
|
|
95
|
+
// Suggestion precedence: explicit opts.suggestion → server suggestion (F11)
|
|
96
|
+
// → scope hint (F6) → coarse/message-driven hintFor(). The first three are
|
|
97
|
+
// intentional overrides; hintFor() is the legacy default. F83: pass the
|
|
98
|
+
// upstream `error` message so a JMESPath depth-limit 422 (which classifies to
|
|
99
|
+
// "unknown") routes to the two-transform-split remedy instead of the generic
|
|
100
|
+
// health hint. The depth detection only fires on the depth-limit wording, so
|
|
101
|
+
// every other message keeps the code-based hint byte-for-byte.
|
|
102
|
+
const suggestion = opts.suggestion ??
|
|
103
|
+
serverSuggestion ??
|
|
104
|
+
scopeSuggestion ??
|
|
105
|
+
hintFor(errorCode, response.error);
|
|
106
|
+
// Code precedence: server domain error_code (F11) → coarse errorCode →
|
|
107
|
+
// opts.code → status. The server code is the most specific, so it wins over
|
|
108
|
+
// the coarse classification (which is often just "unknown" for a 400).
|
|
109
|
+
const code = serverErrorCode ??
|
|
110
|
+
(errorCode !== undefined && errorCode !== ""
|
|
111
|
+
? String(errorCode)
|
|
112
|
+
: opts.code ?? (response.status ? String(response.status) : undefined));
|
|
113
|
+
// Merge server hint fields (valid_types) into details so they reach the
|
|
114
|
+
// agent. Caller-supplied details win on key collision.
|
|
115
|
+
const mergedDetails = serverValidTypes !== undefined
|
|
116
|
+
? { valid_types: serverValidTypes, ...(details ?? {}) }
|
|
117
|
+
: details;
|
|
54
118
|
return errorResult({
|
|
55
119
|
message: response.error ?? opts.message ?? "request failed",
|
|
56
|
-
code
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
suggestion: opts.suggestion ?? hintFor(errorCode),
|
|
60
|
-
...(details !== undefined ? { details } : {}),
|
|
120
|
+
code,
|
|
121
|
+
suggestion,
|
|
122
|
+
...(mergedDetails !== undefined ? { details: mergedDetails } : {}),
|
|
61
123
|
});
|
|
62
124
|
}
|
|
63
125
|
//# sourceMappingURL=tool-result.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result.js","sourceRoot":"","sources":["../../../src/modules/apimapper/tool-result.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,wEAAwE;AACxE,6DAA6D;AAC7D,EAAE;AACF,sBAAsB;AACtB,2BAA2B;AAC3B,mDAAmD;AACnD,wEAAwE;AACxE,0CAA0C;AAC1C,qCAAqC;AACrC,UAAU;AACV,MAAM;AACN,EAAE;AACF,yEAAyE;AACzE,kEAAkE;AAClE,EAAE;AACF,6DAA6D;AAC7D,0EAA0E;AAC1E,yDAAyD;AACzD,2EAA2E;AAC3E,EAAE;AACF,+CAA+C;AAC/C,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,uDAAuD;AACvD,qEAAqE;AACrE,gFAAgF;AAChF,mEAAmE;AACnE,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,yCAAyC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAqB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-result.js","sourceRoot":"","sources":["../../../src/modules/apimapper/tool-result.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,wEAAwE;AACxE,6DAA6D;AAC7D,EAAE;AACF,sBAAsB;AACtB,2BAA2B;AAC3B,mDAAmD;AACnD,wEAAwE;AACxE,0CAA0C;AAC1C,qCAAqC;AACrC,UAAU;AACV,MAAM;AACN,EAAE;AACF,yEAAyE;AACzE,kEAAkE;AAClE,EAAE;AACF,6DAA6D;AAC7D,0EAA0E;AAC1E,yDAAyD;AACzD,2EAA2E;AAC3E,EAAE;AACF,+CAA+C;AAC/C,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,uDAAuD;AACvD,qEAAqE;AACrE,gFAAgF;AAChF,mEAAmE;AACnE,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,yCAAyC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAqB,MAAM,aAAa,CAAC;AAwDzD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAuB,EACvB,OAAiC,EACjC,OAAsB,EAAE;IAExB,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IACrC,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC;IAEhC,uEAAuE;IACvE,4EAA4E;IAC5E,2EAA2E;IAC3E,iEAAiE;IACjE,qEAAqE;IACrE,2EAA2E;IAC3E,sBAAsB;IACtB,MAAM,eAAe,GACnB,IAAI,IAAI,OAAO,IAA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
|
|
1
|
-
import { type CollectedTool } from "./gateway/
|
|
1
|
+
import { type CollectedTool } from "./gateway/collect-module-tools.js";
|
|
2
2
|
/**
|
|
3
3
|
* The minimal `tools/list`-relevant slice of a registered tool: the fields the
|
|
4
4
|
* MCP client receives and the LLM reads as part of the static catalog.
|
|
@@ -23,9 +23,9 @@ export interface ToolsListMeasurement {
|
|
|
23
23
|
}
|
|
24
24
|
/** The full Task-B result: the post-W3 and pre-W3-equivalent surfaces. */
|
|
25
25
|
export interface ToolsListComparison {
|
|
26
|
-
/** Post-W3 `tools/list` — the
|
|
26
|
+
/** Post-W3 `tools/list` — the 21 surface tools the server exposes today. */
|
|
27
27
|
postW3: ToolsListMeasurement;
|
|
28
|
-
/** Pre-W3-equivalent `tools/list` — all
|
|
28
|
+
/** Pre-W3-equivalent `tools/list` — all 79 tools exposed flat (no gateways). */
|
|
29
29
|
preW3Flat: ToolsListMeasurement;
|
|
30
30
|
/** Absolute byte reduction (preW3Flat.totalBytes − postW3.totalBytes). */
|
|
31
31
|
bytesSaved: number;
|
|
@@ -39,18 +39,18 @@ export interface ToolsListComparison {
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function toCatalogEntry(name: string, tool: Pick<CollectedTool, "description" | "inputSchema" | "annotations">): ToolCatalogEntry;
|
|
41
41
|
/**
|
|
42
|
-
* Builds the full
|
|
42
|
+
* Builds the full 81-tool catalog from the current build and measures the
|
|
43
43
|
* post-W3 vs pre-W3-equivalent `tools/list` payload sizes.
|
|
44
44
|
*
|
|
45
45
|
* Surface composition (verified against `gateway/essentials.ts` + `src/index.ts`,
|
|
46
46
|
* pinned live in `gateway/gateway.test.ts` — A2):
|
|
47
|
-
* - module tools :
|
|
48
|
-
* McpServer) + 60 advanced (gateway registry)
|
|
47
|
+
* - module tools : 16 essentials + `apimapper_advanced` + `apimapper_advanced_read`
|
|
48
|
+
* = 18 (on the real McpServer) + 60 advanced (gateway registry) = 78
|
|
49
49
|
* - top-level tools: rest_modules_status + use_profile + list_profiles = 3
|
|
50
|
-
* total =
|
|
50
|
+
* total = 81
|
|
51
51
|
*
|
|
52
|
-
* POST-W3 `tools/list` = the
|
|
53
|
-
* PRE-W3 flat `tools/list` = the
|
|
54
|
-
* tools =
|
|
52
|
+
* POST-W3 `tools/list` = the 18 module-real tools + the 3 top-level tools = 21.
|
|
53
|
+
* PRE-W3 flat `tools/list` = the 19 non-gateway surface tools + the 60 advanced
|
|
54
|
+
* tools = 79 (neither gateway existed pre-W3).
|
|
55
55
|
*/
|
|
56
56
|
export declare function measureToolsList(): Promise<ToolsListComparison>;
|
|
@@ -7,15 +7,23 @@
|
|
|
7
7
|
// Two figures, both derived from the CURRENT build (canonical counts asserted
|
|
8
8
|
// live in gateway/gateway.test.ts — A2, 2026-06-03):
|
|
9
9
|
//
|
|
10
|
-
// - POST-W3 `tools/list` — the
|
|
11
|
-
// (
|
|
12
|
-
// + the 3
|
|
10
|
+
// - POST-W3 `tools/list` — the 21 surface tools the server now exposes
|
|
11
|
+
// (16 module essentials + `apimapper_advanced`
|
|
12
|
+
// + `apimapper_advanced_read` + the 3
|
|
13
|
+
// src/index.ts top-level tools).
|
|
13
14
|
// - PRE-W3-equivalent `tools/list` — what `tools/list` WOULD be if all 79
|
|
14
15
|
// tools were exposed flat (the pre-Gateway
|
|
15
|
-
// state): the
|
|
16
|
-
// gateway
|
|
17
|
-
// tool configs —
|
|
18
|
-
//
|
|
16
|
+
// state): the 21 surface tools minus the TWO
|
|
17
|
+
// gateway tools, plus the 60 advanced-registry
|
|
18
|
+
// tool configs — 79 flat tools. (Pre-W3 neither
|
|
19
|
+
// gateway existed.)
|
|
20
|
+
// F115 (2026-06-11): apimapper_health promoted
|
|
21
|
+
// advanced→essential — surface 19→20, advanced
|
|
22
|
+
// 60→59 then 60. F200b (2026-06-12):
|
|
23
|
+
// apimapper_advanced_read added as a 2nd
|
|
24
|
+
// module-real gateway — surface 20→21; the flat
|
|
25
|
+
// total stays 79 (a gateway is a routing entry,
|
|
26
|
+
// never a flat tool).
|
|
19
27
|
//
|
|
20
28
|
// Per-tool serialization mirrors what the MCP SDK puts on the wire for one
|
|
21
29
|
// `tools/list` entry: `{ name, description, inputSchema, annotations }`, where
|
|
@@ -33,7 +41,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
33
41
|
import { loadModules } from "@getimo/mcp-toolkit";
|
|
34
42
|
import { z } from "zod";
|
|
35
43
|
import { apimapperRestModule } from "./index.js";
|
|
36
|
-
import { collectModuleTools } from "./gateway/
|
|
44
|
+
import { collectModuleTools } from "./gateway/collect-module-tools.js";
|
|
37
45
|
import { registerListProfilesTool, registerUseProfileTool, } from "./use-profile.js";
|
|
38
46
|
import { ProfileStore } from "../../auth/profiles.js";
|
|
39
47
|
/**
|
|
@@ -137,19 +145,19 @@ function captureTopLevelTools() {
|
|
|
137
145
|
return captured;
|
|
138
146
|
}
|
|
139
147
|
/**
|
|
140
|
-
* Builds the full
|
|
148
|
+
* Builds the full 81-tool catalog from the current build and measures the
|
|
141
149
|
* post-W3 vs pre-W3-equivalent `tools/list` payload sizes.
|
|
142
150
|
*
|
|
143
151
|
* Surface composition (verified against `gateway/essentials.ts` + `src/index.ts`,
|
|
144
152
|
* pinned live in `gateway/gateway.test.ts` — A2):
|
|
145
|
-
* - module tools :
|
|
146
|
-
* McpServer) + 60 advanced (gateway registry)
|
|
153
|
+
* - module tools : 16 essentials + `apimapper_advanced` + `apimapper_advanced_read`
|
|
154
|
+
* = 18 (on the real McpServer) + 60 advanced (gateway registry) = 78
|
|
147
155
|
* - top-level tools: rest_modules_status + use_profile + list_profiles = 3
|
|
148
|
-
* total =
|
|
156
|
+
* total = 81
|
|
149
157
|
*
|
|
150
|
-
* POST-W3 `tools/list` = the
|
|
151
|
-
* PRE-W3 flat `tools/list` = the
|
|
152
|
-
* tools =
|
|
158
|
+
* POST-W3 `tools/list` = the 18 module-real tools + the 3 top-level tools = 21.
|
|
159
|
+
* PRE-W3 flat `tools/list` = the 19 non-gateway surface tools + the 60 advanced
|
|
160
|
+
* tools = 79 (neither gateway existed pre-W3).
|
|
153
161
|
*/
|
|
154
162
|
export async function measureToolsList() {
|
|
155
163
|
const server = new McpServer({
|
|
@@ -175,9 +183,12 @@ export async function measureToolsList() {
|
|
|
175
183
|
for (const [name, tool] of topLevelTools) {
|
|
176
184
|
postEntries.push(toCatalogEntry(name, tool));
|
|
177
185
|
}
|
|
178
|
-
// PRE-W3-equivalent flat surface: the post-W3 surface MINUS the gateway
|
|
179
|
-
// (
|
|
180
|
-
|
|
186
|
+
// PRE-W3-equivalent flat surface: the post-W3 surface MINUS the gateway tools
|
|
187
|
+
// (neither existed pre-W3) PLUS every advanced tool exposed flat. F200b added
|
|
188
|
+
// the apimapper_advanced_read gateway — it is a routing entry like
|
|
189
|
+
// apimapper_advanced, not a flat tool, so it is excluded from the pre-W3 flat
|
|
190
|
+
// catalog too (the flat surface still totals 79 real tools).
|
|
191
|
+
const preEntries = postEntries.filter((e) => e.name !== "apimapper_advanced" && e.name !== "apimapper_advanced_read");
|
|
181
192
|
for (const [name, tool] of Object.entries(moduleTools)) {
|
|
182
193
|
if (!advancedNames.has(name))
|
|
183
194
|
continue; // only the advanced tools
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolslist-size.js","sourceRoot":"","sources":["../../../src/modules/apimapper/toolslist-size.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,
|
|
1
|
+
{"version":3,"file":"toolslist-size.js","sourceRoot":"","sources":["../../../src/modules/apimapper/toolslist-size.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,8EAA8E;AAC9E,qDAAqD;AACrD,E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C;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS,CAAC,0BAA0B;QAClE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC5D,MAAM,aAAa,GACjB,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -32,6 +32,11 @@ export interface Connection {
|
|
|
32
32
|
template_fields?: Record<string, unknown>;
|
|
33
33
|
origin_hash?: string;
|
|
34
34
|
origin_id?: string | null;
|
|
35
|
+
health?: {
|
|
36
|
+
status?: string | null;
|
|
37
|
+
message?: string | null;
|
|
38
|
+
[k: string]: unknown;
|
|
39
|
+
} | null;
|
|
35
40
|
}
|
|
36
41
|
export interface Credential {
|
|
37
42
|
id: string;
|
|
@@ -95,6 +100,13 @@ export interface Flow {
|
|
|
95
100
|
version?: number;
|
|
96
101
|
updated_at?: string;
|
|
97
102
|
created_at?: string;
|
|
103
|
+
created_by?: string | null;
|
|
104
|
+
last_execution?: {
|
|
105
|
+
at?: string;
|
|
106
|
+
output_count?: number;
|
|
107
|
+
step_count?: number;
|
|
108
|
+
had_error?: boolean;
|
|
109
|
+
};
|
|
98
110
|
}
|
|
99
111
|
export interface LibraryItem {
|
|
100
112
|
id: string;
|
|
@@ -106,6 +118,7 @@ export interface LibraryItem {
|
|
|
106
118
|
is_activated?: boolean;
|
|
107
119
|
logo_svg?: string;
|
|
108
120
|
logo_hex?: string;
|
|
121
|
+
featured?: boolean;
|
|
109
122
|
}
|
|
110
123
|
export interface NodeSnapshot {
|
|
111
124
|
id: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// - Credential wire format = snake_case (auth_type, auth_data, oauth_provider)
|
|
8
8
|
// - Graph wire format = camelCase (targetNodeId, forceRefresh)
|
|
9
9
|
// - Library wire format = snake_case (extra_fields, library_connection)
|
|
10
|
-
// - LocalSource wire fmt = camelCase (contentType) with "platform/type" id ("wordpress/
|
|
10
|
+
// - LocalSource wire fmt = camelCase (contentType) with "platform/type" id ("wordpress/post")
|
|
11
11
|
//
|
|
12
12
|
// These types reflect the actual REST contract verified against the PHP controllers.
|
|
13
13
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/apimapper/types.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,yEAAyE;AACzE,iGAAiG;AACjG,oFAAoF;AACpF,wEAAwE;AACxE,iFAAiF;AACjF,sEAAsE;AACtE,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/apimapper/types.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,yEAAyE;AACzE,iGAAiG;AACjG,oFAAoF;AACpF,wEAAwE;AACxE,iFAAiF;AACjF,sEAAsE;AACtE,6EAA6E;AAC7E,kGAAkG;AAClG,EAAE;AACF,qFAAqF;AA+KrF,gFAAgF;AAChF,iEAAiE;AACjE,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAmB,KAAmB;IAC1D,OAAO,KAAwD,CAAC;AAClE,CAAC"}
|
|
@@ -123,7 +123,14 @@ export const TOOL_WIRE_MAP = {
|
|
|
123
123
|
},
|
|
124
124
|
apimapper_oauth_authorize_begin: {
|
|
125
125
|
route: "POST /oauth/authorize",
|
|
126
|
-
bodyKeys: [
|
|
126
|
+
bodyKeys: [
|
|
127
|
+
"existing_credential_id",
|
|
128
|
+
"scopes",
|
|
129
|
+
"oauth_config",
|
|
130
|
+
"client_id",
|
|
131
|
+
"client_secret",
|
|
132
|
+
"credential_name",
|
|
133
|
+
],
|
|
127
134
|
kind: "structured",
|
|
128
135
|
},
|
|
129
136
|
// ── Flows ──────────────────────────────────────────────────────────
|
|
@@ -209,6 +216,14 @@ export const TOOL_WIRE_MAP = {
|
|
|
209
216
|
bodyKeys: ["version", "product"],
|
|
210
217
|
kind: "structured",
|
|
211
218
|
},
|
|
219
|
+
// P-B (JMESPath superpowers) — POST /jmespath/test sends the expression +
|
|
220
|
+
// the sample rows to evaluate against. Both are accepted by the WP
|
|
221
|
+
// JmespathTestController / Joomla JmespathTestAjaxHandler.
|
|
222
|
+
apimapper_jmespath_test: {
|
|
223
|
+
route: "POST /jmespath/test",
|
|
224
|
+
bodyKeys: ["expression", "sample_rows"],
|
|
225
|
+
kind: "structured",
|
|
226
|
+
},
|
|
212
227
|
};
|
|
213
228
|
/**
|
|
214
229
|
* Resolve the committed fixture path. From this module
|