@ductape/mcp 0.2.4 → 0.2.6
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/dist/index.js +23 -7
- package/dist/proxy-client.d.ts +1 -1
- package/dist/proxy-client.d.ts.map +1 -1
- package/dist/proxy-client.js +13 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -981,7 +981,8 @@ const snippetGenerateInputSchema = payloadGenerateInputSchema.extend({
|
|
|
981
981
|
language: z.enum(['typescript', 'python']).default('typescript'),
|
|
982
982
|
});
|
|
983
983
|
const schemaInputSchema = z.object({
|
|
984
|
-
module: z.enum(['app', 'product']).optional().describe('Optional. Scope the result to
|
|
984
|
+
module: z.enum(['app', 'product']).optional().describe('Optional. Scope the result to one module. With no method, returns only the compact list of available methods.'),
|
|
985
|
+
method: z.string().optional().describe('Optional method key such as "databases.create" or "notifications.update". Use with module to return only that method schema.'),
|
|
985
986
|
});
|
|
986
987
|
function toPrettyJson(value) {
|
|
987
988
|
return JSON.stringify(value ?? {}, null, 2);
|
|
@@ -4683,8 +4684,23 @@ async function main() {
|
|
|
4683
4684
|
};
|
|
4684
4685
|
const schemaHandler = async (args) => {
|
|
4685
4686
|
try {
|
|
4686
|
-
|
|
4687
|
-
|
|
4687
|
+
if (args.method && !args.module) {
|
|
4688
|
+
throw new Error('module is required when method is provided');
|
|
4689
|
+
}
|
|
4690
|
+
const data = await getAssetSchemas(args.module, args.method);
|
|
4691
|
+
const compactData = args.module &&
|
|
4692
|
+
!args.method &&
|
|
4693
|
+
data &&
|
|
4694
|
+
typeof data === 'object' &&
|
|
4695
|
+
!Array.isArray(data.methods) &&
|
|
4696
|
+
data.methods
|
|
4697
|
+
? {
|
|
4698
|
+
module: args.module,
|
|
4699
|
+
methods: Object.keys(data.methods),
|
|
4700
|
+
hint: `Call ductape_schema with module="${args.module}" and one method for its complete field schema`,
|
|
4701
|
+
}
|
|
4702
|
+
: data;
|
|
4703
|
+
return { content: [{ type: 'text', text: JSON.stringify(compactData ?? null, null, 2) }] };
|
|
4688
4704
|
}
|
|
4689
4705
|
catch (err) {
|
|
4690
4706
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -4722,10 +4738,10 @@ async function main() {
|
|
|
4722
4738
|
}, snippetGenerateHandler);
|
|
4723
4739
|
server.registerTool('ductape_schema', {
|
|
4724
4740
|
title: 'Ductape Asset Schema',
|
|
4725
|
-
description: 'Returns
|
|
4726
|
-
'
|
|
4727
|
-
'
|
|
4728
|
-
'
|
|
4741
|
+
description: 'Returns a compact method index or one targeted asset schema derived from the SDK Joi validators. ' +
|
|
4742
|
+
'Call with module="app" or module="product" first to list method keys, then call again with ' +
|
|
4743
|
+
'module and method (for example method="databases.create") for the complete field schema. ' +
|
|
4744
|
+
'Avoid calling without module unless you explicitly need the entire manifest.\n\n' +
|
|
4729
4745
|
'ALWAYS call this before constructing a file for "resources <type> create" or any cloud ' +
|
|
4730
4746
|
'import/provision operation — field shapes are not guessable from context.\n\n' +
|
|
4731
4747
|
'Conditional fields: some fields are returned as oneOf (an array of variant shapes). ' +
|
package/dist/proxy-client.d.ts
CHANGED
|
@@ -24,6 +24,6 @@ export interface IGenerateExecutablePayloadResponse {
|
|
|
24
24
|
payload: Record<string, unknown>;
|
|
25
25
|
meta: Record<string, unknown>;
|
|
26
26
|
}
|
|
27
|
-
export declare function getAssetSchemas(module?: string): Promise<unknown>;
|
|
27
|
+
export declare function getAssetSchemas(module?: string, method?: string): Promise<unknown>;
|
|
28
28
|
export declare function generateExecutablePayload<T = IGenerateExecutablePayloadResponse>(request: IGenerateExecutablePayloadRequest): Promise<T>;
|
|
29
29
|
//# sourceMappingURL=proxy-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-client.d.ts","sourceRoot":"","sources":["../src/proxy-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAEtD,MAAM,MAAM,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AC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBxF;AA4BD,wBAAsB,yBAAyB,CAAC,CAAC,GAAG,kCAAkC,EACpF,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,CAAC,CAAC,CAiCZ"}
|
package/dist/proxy-client.js
CHANGED
|
@@ -28,11 +28,22 @@ export async function executeViaProxy(publishable_key, module, method, params =
|
|
|
28
28
|
}
|
|
29
29
|
return body.data?.data;
|
|
30
30
|
}
|
|
31
|
-
export async function getAssetSchemas(module) {
|
|
32
|
-
const path = module
|
|
31
|
+
export async function getAssetSchemas(module, method) {
|
|
32
|
+
const path = module
|
|
33
|
+
? `/proxy/v1/schema/${encodeURIComponent(module)}${method ? `/${encodeURIComponent(method)}` : ''}`
|
|
34
|
+
: '/proxy/v1/schema';
|
|
33
35
|
const url = `${API_BASE_URL.replace(/\/$/, '')}${path}`;
|
|
34
36
|
const res = await fetch(url);
|
|
35
37
|
const body = (await res.json());
|
|
38
|
+
if (res.status === 404 && module && method) {
|
|
39
|
+
const fallbackUrl = `${API_BASE_URL.replace(/\/$/, '')}/proxy/v1/schema/${encodeURIComponent(module)}`;
|
|
40
|
+
const fallbackRes = await fetch(fallbackUrl);
|
|
41
|
+
const fallbackBody = (await fallbackRes.json());
|
|
42
|
+
const methodSchema = fallbackBody.data?.methods?.[method];
|
|
43
|
+
if (fallbackRes.ok && methodSchema) {
|
|
44
|
+
return { module, method, schema: methodSchema };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
36
47
|
if (!res.ok) {
|
|
37
48
|
throw new Error(body.message ?? `Schema request failed: ${res.status}`);
|
|
38
49
|
}
|