@signaliz/sdk 1.0.4 → 1.0.5
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/{chunk-EVZZQTWE.mjs → chunk-GF2T2X3W.mjs} +55 -29
- package/dist/cli.js +55 -29
- package/dist/cli.mjs +1 -1
- package/dist/index.js +55 -29
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +55 -29
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
|
@@ -284,7 +284,7 @@ function unwrapMcpResponse(data) {
|
|
|
284
284
|
function unwrapMcpPayload(payload) {
|
|
285
285
|
if (isRecord(payload)) {
|
|
286
286
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
287
|
-
return payload.result;
|
|
287
|
+
return unwrapMcpPayload(payload.result);
|
|
288
288
|
}
|
|
289
289
|
if (payload.ok === false) {
|
|
290
290
|
const first = firstPayloadError(payload);
|
|
@@ -805,15 +805,17 @@ var Campaigns = class {
|
|
|
805
805
|
args.idempotency_key = options.idempotencyKey;
|
|
806
806
|
}
|
|
807
807
|
const data = await this.callMcp("build_campaign", args);
|
|
808
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
809
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
808
810
|
return {
|
|
809
811
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
810
812
|
campaignId: data.campaign_id ?? null,
|
|
811
813
|
campaignObject: data.campaign_object ?? null,
|
|
812
|
-
status:
|
|
813
|
-
currentPhase:
|
|
814
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
815
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
814
816
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
815
|
-
message
|
|
816
|
-
dryRun:
|
|
817
|
+
message,
|
|
818
|
+
dryRun: isDryRun,
|
|
817
819
|
requestedTargetCount: data.requested_target_count,
|
|
818
820
|
plannedTargetCount: data.planned_target_count,
|
|
819
821
|
estimatedCredits: data.estimated_credits,
|
|
@@ -927,8 +929,8 @@ function mapStatus(data) {
|
|
|
927
929
|
recordsProcessed: data.records_processed ?? 0,
|
|
928
930
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
929
931
|
recordsFailed: data.records_failed ?? 0,
|
|
930
|
-
warnings: data.warnings
|
|
931
|
-
errors: data.errors
|
|
932
|
+
warnings: diagnosticMessages(data.warnings),
|
|
933
|
+
errors: diagnosticMessages(data.errors),
|
|
932
934
|
artifactCount: data.artifact_count ?? 0,
|
|
933
935
|
providerRoute: mapProviderRoute(data),
|
|
934
936
|
nextAction: data.next_action ?? "",
|
|
@@ -963,6 +965,14 @@ function recordOrNull(value) {
|
|
|
963
965
|
function stringArray(value) {
|
|
964
966
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
965
967
|
}
|
|
968
|
+
function diagnosticMessages(value) {
|
|
969
|
+
if (!Array.isArray(value)) return [];
|
|
970
|
+
return value.map((item) => {
|
|
971
|
+
if (typeof item === "string") return item;
|
|
972
|
+
const record = recordOrNull(item);
|
|
973
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
974
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
975
|
+
}
|
|
966
976
|
function booleanOrNull(value) {
|
|
967
977
|
return typeof value === "boolean" ? value : null;
|
|
968
978
|
}
|
|
@@ -2290,22 +2300,22 @@ function queryFieldFor(kind) {
|
|
|
2290
2300
|
function statusCommandFor(kind, id) {
|
|
2291
2301
|
switch (kind) {
|
|
2292
2302
|
case "op":
|
|
2293
|
-
return `signaliz status ${id}`;
|
|
2303
|
+
return `signaliz ops status ${id}`;
|
|
2294
2304
|
case "trigger_run":
|
|
2295
2305
|
case "dataplane_run":
|
|
2296
2306
|
case "replay_run":
|
|
2297
|
-
return `signaliz
|
|
2307
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2298
2308
|
case "queue_job":
|
|
2299
|
-
return `signaliz queue --job-id ${id}`;
|
|
2309
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2300
2310
|
case "routine":
|
|
2301
|
-
return `signaliz routine ${id}`;
|
|
2311
|
+
return `signaliz ops routine ${id}`;
|
|
2302
2312
|
default:
|
|
2303
2313
|
return void 0;
|
|
2304
2314
|
}
|
|
2305
2315
|
}
|
|
2306
2316
|
function replayCommandFor(kind, id) {
|
|
2307
2317
|
if (kind !== "execution_event") return void 0;
|
|
2308
|
-
return `signaliz replay ${id}`;
|
|
2318
|
+
return `signaliz ops replay ${id}`;
|
|
2309
2319
|
}
|
|
2310
2320
|
|
|
2311
2321
|
// src/resources/ops.ts
|
|
@@ -4586,6 +4596,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4586
4596
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4587
4597
|
return void 0;
|
|
4588
4598
|
}
|
|
4599
|
+
function mapMcpToolInfo(t) {
|
|
4600
|
+
const annotations = asRecord3(t.annotations);
|
|
4601
|
+
const execution = asRecord3(t.execution);
|
|
4602
|
+
const schemas = asRecord3(t.schemas);
|
|
4603
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4604
|
+
return {
|
|
4605
|
+
name,
|
|
4606
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4607
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4608
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4609
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4610
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4611
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4612
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4613
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4614
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4615
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4616
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4617
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4618
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4619
|
+
annotations
|
|
4620
|
+
};
|
|
4621
|
+
}
|
|
4589
4622
|
function asRecord3(value) {
|
|
4590
4623
|
return value && typeof value === "object" ? value : void 0;
|
|
4591
4624
|
}
|
|
@@ -4650,25 +4683,18 @@ var Signaliz = class {
|
|
|
4650
4683
|
}
|
|
4651
4684
|
/** List all available MCP tools */
|
|
4652
4685
|
async listTools() {
|
|
4686
|
+
try {
|
|
4687
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4688
|
+
name: "get_tool_manifest",
|
|
4689
|
+
arguments: { include_schemas: true }
|
|
4690
|
+
});
|
|
4691
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4692
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4693
|
+
} catch (_err) {
|
|
4694
|
+
}
|
|
4653
4695
|
const data = await this.client.mcp("tools/list", {});
|
|
4654
4696
|
const tools = data?.tools ?? data ?? [];
|
|
4655
|
-
return tools.map(
|
|
4656
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4657
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4658
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4659
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4660
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4661
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4662
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4663
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4664
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4665
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4666
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4667
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4668
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4669
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4670
|
-
annotations: asRecord3(t.annotations)
|
|
4671
|
-
}));
|
|
4697
|
+
return tools.map(mapMcpToolInfo);
|
|
4672
4698
|
}
|
|
4673
4699
|
/** Discover tools by natural language query */
|
|
4674
4700
|
async discover(query, category) {
|
package/dist/cli.js
CHANGED
|
@@ -287,7 +287,7 @@ function unwrapMcpResponse(data) {
|
|
|
287
287
|
function unwrapMcpPayload(payload) {
|
|
288
288
|
if (isRecord(payload)) {
|
|
289
289
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
290
|
-
return payload.result;
|
|
290
|
+
return unwrapMcpPayload(payload.result);
|
|
291
291
|
}
|
|
292
292
|
if (payload.ok === false) {
|
|
293
293
|
const first = firstPayloadError(payload);
|
|
@@ -808,15 +808,17 @@ var Campaigns = class {
|
|
|
808
808
|
args.idempotency_key = options.idempotencyKey;
|
|
809
809
|
}
|
|
810
810
|
const data = await this.callMcp("build_campaign", args);
|
|
811
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
812
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
811
813
|
return {
|
|
812
814
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
813
815
|
campaignId: data.campaign_id ?? null,
|
|
814
816
|
campaignObject: data.campaign_object ?? null,
|
|
815
|
-
status:
|
|
816
|
-
currentPhase:
|
|
817
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
818
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
817
819
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
818
|
-
message
|
|
819
|
-
dryRun:
|
|
820
|
+
message,
|
|
821
|
+
dryRun: isDryRun,
|
|
820
822
|
requestedTargetCount: data.requested_target_count,
|
|
821
823
|
plannedTargetCount: data.planned_target_count,
|
|
822
824
|
estimatedCredits: data.estimated_credits,
|
|
@@ -930,8 +932,8 @@ function mapStatus(data) {
|
|
|
930
932
|
recordsProcessed: data.records_processed ?? 0,
|
|
931
933
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
932
934
|
recordsFailed: data.records_failed ?? 0,
|
|
933
|
-
warnings: data.warnings
|
|
934
|
-
errors: data.errors
|
|
935
|
+
warnings: diagnosticMessages(data.warnings),
|
|
936
|
+
errors: diagnosticMessages(data.errors),
|
|
935
937
|
artifactCount: data.artifact_count ?? 0,
|
|
936
938
|
providerRoute: mapProviderRoute(data),
|
|
937
939
|
nextAction: data.next_action ?? "",
|
|
@@ -966,6 +968,14 @@ function recordOrNull(value) {
|
|
|
966
968
|
function stringArray(value) {
|
|
967
969
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
968
970
|
}
|
|
971
|
+
function diagnosticMessages(value) {
|
|
972
|
+
if (!Array.isArray(value)) return [];
|
|
973
|
+
return value.map((item) => {
|
|
974
|
+
if (typeof item === "string") return item;
|
|
975
|
+
const record = recordOrNull(item);
|
|
976
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
977
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
978
|
+
}
|
|
969
979
|
function booleanOrNull(value) {
|
|
970
980
|
return typeof value === "boolean" ? value : null;
|
|
971
981
|
}
|
|
@@ -2286,22 +2296,22 @@ function queryFieldFor(kind) {
|
|
|
2286
2296
|
function statusCommandFor(kind, id) {
|
|
2287
2297
|
switch (kind) {
|
|
2288
2298
|
case "op":
|
|
2289
|
-
return `signaliz status ${id}`;
|
|
2299
|
+
return `signaliz ops status ${id}`;
|
|
2290
2300
|
case "trigger_run":
|
|
2291
2301
|
case "dataplane_run":
|
|
2292
2302
|
case "replay_run":
|
|
2293
|
-
return `signaliz
|
|
2303
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2294
2304
|
case "queue_job":
|
|
2295
|
-
return `signaliz queue --job-id ${id}`;
|
|
2305
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2296
2306
|
case "routine":
|
|
2297
|
-
return `signaliz routine ${id}`;
|
|
2307
|
+
return `signaliz ops routine ${id}`;
|
|
2298
2308
|
default:
|
|
2299
2309
|
return void 0;
|
|
2300
2310
|
}
|
|
2301
2311
|
}
|
|
2302
2312
|
function replayCommandFor(kind, id) {
|
|
2303
2313
|
if (kind !== "execution_event") return void 0;
|
|
2304
|
-
return `signaliz replay ${id}`;
|
|
2314
|
+
return `signaliz ops replay ${id}`;
|
|
2305
2315
|
}
|
|
2306
2316
|
|
|
2307
2317
|
// src/resources/ops.ts
|
|
@@ -4582,6 +4592,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4582
4592
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4583
4593
|
return void 0;
|
|
4584
4594
|
}
|
|
4595
|
+
function mapMcpToolInfo(t) {
|
|
4596
|
+
const annotations = asRecord3(t.annotations);
|
|
4597
|
+
const execution = asRecord3(t.execution);
|
|
4598
|
+
const schemas = asRecord3(t.schemas);
|
|
4599
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4600
|
+
return {
|
|
4601
|
+
name,
|
|
4602
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4603
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4604
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4605
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4606
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4607
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4608
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4609
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4610
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4611
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4612
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4613
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4614
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4615
|
+
annotations
|
|
4616
|
+
};
|
|
4617
|
+
}
|
|
4585
4618
|
function asRecord3(value) {
|
|
4586
4619
|
return value && typeof value === "object" ? value : void 0;
|
|
4587
4620
|
}
|
|
@@ -4646,25 +4679,18 @@ var Signaliz = class {
|
|
|
4646
4679
|
}
|
|
4647
4680
|
/** List all available MCP tools */
|
|
4648
4681
|
async listTools() {
|
|
4682
|
+
try {
|
|
4683
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4684
|
+
name: "get_tool_manifest",
|
|
4685
|
+
arguments: { include_schemas: true }
|
|
4686
|
+
});
|
|
4687
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4688
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4689
|
+
} catch (_err) {
|
|
4690
|
+
}
|
|
4649
4691
|
const data = await this.client.mcp("tools/list", {});
|
|
4650
4692
|
const tools = data?.tools ?? data ?? [];
|
|
4651
|
-
return tools.map(
|
|
4652
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4653
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4654
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4655
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4656
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4657
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4658
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4659
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4660
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4661
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4662
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4663
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4664
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4665
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4666
|
-
annotations: asRecord3(t.annotations)
|
|
4667
|
-
}));
|
|
4693
|
+
return tools.map(mapMcpToolInfo);
|
|
4668
4694
|
}
|
|
4669
4695
|
/** Discover tools by natural language query */
|
|
4670
4696
|
async discover(query, category) {
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -323,7 +323,7 @@ function unwrapMcpResponse(data) {
|
|
|
323
323
|
function unwrapMcpPayload(payload) {
|
|
324
324
|
if (isRecord(payload)) {
|
|
325
325
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
326
|
-
return payload.result;
|
|
326
|
+
return unwrapMcpPayload(payload.result);
|
|
327
327
|
}
|
|
328
328
|
if (payload.ok === false) {
|
|
329
329
|
const first = firstPayloadError(payload);
|
|
@@ -844,15 +844,17 @@ var Campaigns = class {
|
|
|
844
844
|
args.idempotency_key = options.idempotencyKey;
|
|
845
845
|
}
|
|
846
846
|
const data = await this.callMcp("build_campaign", args);
|
|
847
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
848
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
847
849
|
return {
|
|
848
850
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
849
851
|
campaignId: data.campaign_id ?? null,
|
|
850
852
|
campaignObject: data.campaign_object ?? null,
|
|
851
|
-
status:
|
|
852
|
-
currentPhase:
|
|
853
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
854
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
853
855
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
854
|
-
message
|
|
855
|
-
dryRun:
|
|
856
|
+
message,
|
|
857
|
+
dryRun: isDryRun,
|
|
856
858
|
requestedTargetCount: data.requested_target_count,
|
|
857
859
|
plannedTargetCount: data.planned_target_count,
|
|
858
860
|
estimatedCredits: data.estimated_credits,
|
|
@@ -966,8 +968,8 @@ function mapStatus(data) {
|
|
|
966
968
|
recordsProcessed: data.records_processed ?? 0,
|
|
967
969
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
968
970
|
recordsFailed: data.records_failed ?? 0,
|
|
969
|
-
warnings: data.warnings
|
|
970
|
-
errors: data.errors
|
|
971
|
+
warnings: diagnosticMessages(data.warnings),
|
|
972
|
+
errors: diagnosticMessages(data.errors),
|
|
971
973
|
artifactCount: data.artifact_count ?? 0,
|
|
972
974
|
providerRoute: mapProviderRoute(data),
|
|
973
975
|
nextAction: data.next_action ?? "",
|
|
@@ -1002,6 +1004,14 @@ function recordOrNull(value) {
|
|
|
1002
1004
|
function stringArray(value) {
|
|
1003
1005
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
1004
1006
|
}
|
|
1007
|
+
function diagnosticMessages(value) {
|
|
1008
|
+
if (!Array.isArray(value)) return [];
|
|
1009
|
+
return value.map((item) => {
|
|
1010
|
+
if (typeof item === "string") return item;
|
|
1011
|
+
const record = recordOrNull(item);
|
|
1012
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
1013
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
1014
|
+
}
|
|
1005
1015
|
function booleanOrNull(value) {
|
|
1006
1016
|
return typeof value === "boolean" ? value : null;
|
|
1007
1017
|
}
|
|
@@ -2329,22 +2339,22 @@ function queryFieldFor(kind) {
|
|
|
2329
2339
|
function statusCommandFor(kind, id) {
|
|
2330
2340
|
switch (kind) {
|
|
2331
2341
|
case "op":
|
|
2332
|
-
return `signaliz status ${id}`;
|
|
2342
|
+
return `signaliz ops status ${id}`;
|
|
2333
2343
|
case "trigger_run":
|
|
2334
2344
|
case "dataplane_run":
|
|
2335
2345
|
case "replay_run":
|
|
2336
|
-
return `signaliz
|
|
2346
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2337
2347
|
case "queue_job":
|
|
2338
|
-
return `signaliz queue --job-id ${id}`;
|
|
2348
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2339
2349
|
case "routine":
|
|
2340
|
-
return `signaliz routine ${id}`;
|
|
2350
|
+
return `signaliz ops routine ${id}`;
|
|
2341
2351
|
default:
|
|
2342
2352
|
return void 0;
|
|
2343
2353
|
}
|
|
2344
2354
|
}
|
|
2345
2355
|
function replayCommandFor(kind, id) {
|
|
2346
2356
|
if (kind !== "execution_event") return void 0;
|
|
2347
|
-
return `signaliz replay ${id}`;
|
|
2357
|
+
return `signaliz ops replay ${id}`;
|
|
2348
2358
|
}
|
|
2349
2359
|
|
|
2350
2360
|
// src/resources/ops.ts
|
|
@@ -4625,6 +4635,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4625
4635
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4626
4636
|
return void 0;
|
|
4627
4637
|
}
|
|
4638
|
+
function mapMcpToolInfo(t) {
|
|
4639
|
+
const annotations = asRecord3(t.annotations);
|
|
4640
|
+
const execution = asRecord3(t.execution);
|
|
4641
|
+
const schemas = asRecord3(t.schemas);
|
|
4642
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4643
|
+
return {
|
|
4644
|
+
name,
|
|
4645
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4646
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4647
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4648
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4649
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4650
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4651
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4652
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4653
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4654
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4655
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4656
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4657
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4658
|
+
annotations
|
|
4659
|
+
};
|
|
4660
|
+
}
|
|
4628
4661
|
function asRecord3(value) {
|
|
4629
4662
|
return value && typeof value === "object" ? value : void 0;
|
|
4630
4663
|
}
|
|
@@ -4689,25 +4722,18 @@ var Signaliz = class {
|
|
|
4689
4722
|
}
|
|
4690
4723
|
/** List all available MCP tools */
|
|
4691
4724
|
async listTools() {
|
|
4725
|
+
try {
|
|
4726
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4727
|
+
name: "get_tool_manifest",
|
|
4728
|
+
arguments: { include_schemas: true }
|
|
4729
|
+
});
|
|
4730
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4731
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4732
|
+
} catch (_err) {
|
|
4733
|
+
}
|
|
4692
4734
|
const data = await this.client.mcp("tools/list", {});
|
|
4693
4735
|
const tools = data?.tools ?? data ?? [];
|
|
4694
|
-
return tools.map(
|
|
4695
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4696
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4697
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4698
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4699
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4700
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4701
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4702
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4703
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4704
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4705
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4706
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4707
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4708
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4709
|
-
annotations: asRecord3(t.annotations)
|
|
4710
|
-
}));
|
|
4736
|
+
return tools.map(mapMcpToolInfo);
|
|
4711
4737
|
}
|
|
4712
4738
|
/** Discover tools by natural language query */
|
|
4713
4739
|
async discover(query, category) {
|
package/dist/index.mjs
CHANGED
package/dist/mcp-config.js
CHANGED
|
@@ -315,7 +315,7 @@ function unwrapMcpResponse(data) {
|
|
|
315
315
|
function unwrapMcpPayload(payload) {
|
|
316
316
|
if (isRecord(payload)) {
|
|
317
317
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
318
|
-
return payload.result;
|
|
318
|
+
return unwrapMcpPayload(payload.result);
|
|
319
319
|
}
|
|
320
320
|
if (payload.ok === false) {
|
|
321
321
|
const first = firstPayloadError(payload);
|
|
@@ -836,15 +836,17 @@ var Campaigns = class {
|
|
|
836
836
|
args.idempotency_key = options.idempotencyKey;
|
|
837
837
|
}
|
|
838
838
|
const data = await this.callMcp("build_campaign", args);
|
|
839
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
840
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
839
841
|
return {
|
|
840
842
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
841
843
|
campaignId: data.campaign_id ?? null,
|
|
842
844
|
campaignObject: data.campaign_object ?? null,
|
|
843
|
-
status:
|
|
844
|
-
currentPhase:
|
|
845
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
846
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
845
847
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
846
|
-
message
|
|
847
|
-
dryRun:
|
|
848
|
+
message,
|
|
849
|
+
dryRun: isDryRun,
|
|
848
850
|
requestedTargetCount: data.requested_target_count,
|
|
849
851
|
plannedTargetCount: data.planned_target_count,
|
|
850
852
|
estimatedCredits: data.estimated_credits,
|
|
@@ -958,8 +960,8 @@ function mapStatus(data) {
|
|
|
958
960
|
recordsProcessed: data.records_processed ?? 0,
|
|
959
961
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
960
962
|
recordsFailed: data.records_failed ?? 0,
|
|
961
|
-
warnings: data.warnings
|
|
962
|
-
errors: data.errors
|
|
963
|
+
warnings: diagnosticMessages(data.warnings),
|
|
964
|
+
errors: diagnosticMessages(data.errors),
|
|
963
965
|
artifactCount: data.artifact_count ?? 0,
|
|
964
966
|
providerRoute: mapProviderRoute(data),
|
|
965
967
|
nextAction: data.next_action ?? "",
|
|
@@ -994,6 +996,14 @@ function recordOrNull(value) {
|
|
|
994
996
|
function stringArray(value) {
|
|
995
997
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
996
998
|
}
|
|
999
|
+
function diagnosticMessages(value) {
|
|
1000
|
+
if (!Array.isArray(value)) return [];
|
|
1001
|
+
return value.map((item) => {
|
|
1002
|
+
if (typeof item === "string") return item;
|
|
1003
|
+
const record = recordOrNull(item);
|
|
1004
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
1005
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
1006
|
+
}
|
|
997
1007
|
function booleanOrNull(value) {
|
|
998
1008
|
return typeof value === "boolean" ? value : null;
|
|
999
1009
|
}
|
|
@@ -2314,22 +2324,22 @@ function queryFieldFor(kind) {
|
|
|
2314
2324
|
function statusCommandFor(kind, id) {
|
|
2315
2325
|
switch (kind) {
|
|
2316
2326
|
case "op":
|
|
2317
|
-
return `signaliz status ${id}`;
|
|
2327
|
+
return `signaliz ops status ${id}`;
|
|
2318
2328
|
case "trigger_run":
|
|
2319
2329
|
case "dataplane_run":
|
|
2320
2330
|
case "replay_run":
|
|
2321
|
-
return `signaliz
|
|
2331
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2322
2332
|
case "queue_job":
|
|
2323
|
-
return `signaliz queue --job-id ${id}`;
|
|
2333
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2324
2334
|
case "routine":
|
|
2325
|
-
return `signaliz routine ${id}`;
|
|
2335
|
+
return `signaliz ops routine ${id}`;
|
|
2326
2336
|
default:
|
|
2327
2337
|
return void 0;
|
|
2328
2338
|
}
|
|
2329
2339
|
}
|
|
2330
2340
|
function replayCommandFor(kind, id) {
|
|
2331
2341
|
if (kind !== "execution_event") return void 0;
|
|
2332
|
-
return `signaliz replay ${id}`;
|
|
2342
|
+
return `signaliz ops replay ${id}`;
|
|
2333
2343
|
}
|
|
2334
2344
|
|
|
2335
2345
|
// src/resources/ops.ts
|
|
@@ -4610,6 +4620,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4610
4620
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4611
4621
|
return void 0;
|
|
4612
4622
|
}
|
|
4623
|
+
function mapMcpToolInfo(t) {
|
|
4624
|
+
const annotations = asRecord3(t.annotations);
|
|
4625
|
+
const execution = asRecord3(t.execution);
|
|
4626
|
+
const schemas = asRecord3(t.schemas);
|
|
4627
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4628
|
+
return {
|
|
4629
|
+
name,
|
|
4630
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4631
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4632
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4633
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4634
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4635
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4636
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4637
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4638
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4639
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4640
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4641
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4642
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4643
|
+
annotations
|
|
4644
|
+
};
|
|
4645
|
+
}
|
|
4613
4646
|
function asRecord3(value) {
|
|
4614
4647
|
return value && typeof value === "object" ? value : void 0;
|
|
4615
4648
|
}
|
|
@@ -4674,25 +4707,18 @@ var Signaliz = class {
|
|
|
4674
4707
|
}
|
|
4675
4708
|
/** List all available MCP tools */
|
|
4676
4709
|
async listTools() {
|
|
4710
|
+
try {
|
|
4711
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4712
|
+
name: "get_tool_manifest",
|
|
4713
|
+
arguments: { include_schemas: true }
|
|
4714
|
+
});
|
|
4715
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4716
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4717
|
+
} catch (_err) {
|
|
4718
|
+
}
|
|
4677
4719
|
const data = await this.client.mcp("tools/list", {});
|
|
4678
4720
|
const tools = data?.tools ?? data ?? [];
|
|
4679
|
-
return tools.map(
|
|
4680
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4681
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4682
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4683
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4684
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4685
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4686
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4687
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4688
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4689
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4690
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4691
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4692
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4693
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4694
|
-
annotations: asRecord3(t.annotations)
|
|
4695
|
-
}));
|
|
4721
|
+
return tools.map(mapMcpToolInfo);
|
|
4696
4722
|
}
|
|
4697
4723
|
/** Discover tools by natural language query */
|
|
4698
4724
|
async discover(query, category) {
|
package/dist/mcp-config.mjs
CHANGED