@signaliz/sdk 1.0.3 → 1.0.4

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.
@@ -202,13 +202,14 @@ var HttpClient = class {
202
202
  details: { responseText: text.slice(0, 500) }
203
203
  });
204
204
  }
205
- if (data.error) {
205
+ const responseError = isRecord(data) && isRecord(data.error) ? data.error : null;
206
+ if (responseError) {
206
207
  const err = new SignalizError({
207
- code: data.error.code?.toString() || data.error.data?.error_code || "MCP_ERROR",
208
- message: data.error.message || "MCP request failed",
209
- errorType: mapMcpErrorType(data.error),
210
- retryAfter: data.error.data?.retry_after,
211
- details: data.error.data
208
+ code: firstString(responseError.code, isRecord(responseError.data) ? responseError.data.error_code : void 0) || "MCP_ERROR",
209
+ message: firstString(responseError.message) || "MCP request failed",
210
+ errorType: mapMcpErrorType(responseError),
211
+ retryAfter: isRecord(responseError.data) && typeof responseError.data.retry_after === "number" ? responseError.data.retry_after : void 0,
212
+ details: isRecord(responseError.data) ? responseError.data : void 0
212
213
  });
213
214
  if (err.isRetryable && attempt < this.maxRetries) {
214
215
  lastError = err;
@@ -285,35 +286,63 @@ function normalizeMcpParams(method, params) {
285
286
  }
286
287
  };
287
288
  }
289
+ function isRecord(value) {
290
+ return typeof value === "object" && value !== null;
291
+ }
292
+ function firstString(...values) {
293
+ const value = values.find((item) => typeof item === "string" && item.length > 0);
294
+ return typeof value === "string" ? value : void 0;
295
+ }
296
+ function firstPayloadError(payload) {
297
+ const errors = payload.errors;
298
+ const first = Array.isArray(errors) ? errors[0] : void 0;
299
+ return isRecord(first) ? first : {};
300
+ }
288
301
  function unwrapMcpResponse(data) {
289
- if (data?.result?.structuredContent !== void 0) {
290
- return unwrapMcpPayload(data.result.structuredContent);
302
+ const result = isRecord(data) ? data.result : void 0;
303
+ if (isRecord(result) && result.structuredContent !== void 0) {
304
+ return unwrapMcpPayload(result.structuredContent);
291
305
  }
292
- const text = data?.result?.content?.[0]?.text;
306
+ const content = isRecord(result) ? result.content : void 0;
307
+ const firstContent = Array.isArray(content) ? content[0] : void 0;
308
+ const text = isRecord(firstContent) ? firstContent.text : void 0;
293
309
  if (typeof text === "string") {
294
310
  const parsed = safeJson(text);
295
311
  return unwrapMcpPayload(parsed ?? text);
296
312
  }
297
- return unwrapMcpPayload(data?.result);
313
+ return unwrapMcpPayload(result);
298
314
  }
299
315
  function unwrapMcpPayload(payload) {
300
- if (payload && typeof payload === "object") {
316
+ if (isRecord(payload)) {
301
317
  if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
302
318
  return payload.result;
303
319
  }
320
+ if (payload.ok === false) {
321
+ const first = firstPayloadError(payload);
322
+ const code = firstString(first.code, payload.error_code, payload.code) || (payload.approval_required ? "APPROVAL_REQUIRED" : "MCP_ERROR");
323
+ throw new SignalizError({
324
+ code,
325
+ message: firstString(first.message, payload.message, payload.summary, payload.error) || "MCP request failed",
326
+ errorType: mapErrorTypeFromCode(code),
327
+ details: {
328
+ ...payload,
329
+ ...isRecord(first.details) ? first.details : {}
330
+ }
331
+ });
332
+ }
304
333
  if (payload.success === true && Object.prototype.hasOwnProperty.call(payload, "data")) {
305
334
  return payload.data;
306
335
  }
307
336
  if (payload.success === false) {
308
- const first = Array.isArray(payload.errors) ? payload.errors[0] ?? {} : {};
309
- const code = first.code || payload.error_code || (payload.approval_required ? "APPROVAL_REQUIRED" : "MCP_ERROR");
337
+ const first = firstPayloadError(payload);
338
+ const code = firstString(first.code, payload.error_code) || (payload.approval_required ? "APPROVAL_REQUIRED" : "MCP_ERROR");
310
339
  throw new SignalizError({
311
340
  code,
312
- message: first.message || payload.message || payload.summary || "MCP request failed",
341
+ message: firstString(first.message, payload.message, payload.summary) || "MCP request failed",
313
342
  errorType: mapErrorTypeFromCode(code),
314
343
  details: {
315
344
  ...payload,
316
- ...first.details && typeof first.details === "object" ? first.details : {}
345
+ ...isRecord(first.details) ? first.details : {}
317
346
  }
318
347
  });
319
348
  }
@@ -321,8 +350,10 @@ function unwrapMcpPayload(payload) {
321
350
  return payload;
322
351
  }
323
352
  function mapMcpErrorType(error) {
324
- const code = String(error?.data?.error_code || error?.code || "");
325
- const message = String(error?.message || "").toLowerCase();
353
+ const errorRecord = isRecord(error) ? error : {};
354
+ const data = isRecord(errorRecord.data) ? errorRecord.data : {};
355
+ const code = String(data.error_code || errorRecord.code || "");
356
+ const message = String(errorRecord.message || "").toLowerCase();
326
357
  if (code === "429" || message.includes("rate limit")) return "rate_limited";
327
358
  if (code === "401" || code === "AUTH_001" || message.includes("auth")) return "auth_expired";
328
359
  if (code === "400" || code === "-32602" || message.includes("invalid")) return "validation";
@@ -2946,6 +2977,10 @@ function normalizeOpsProofResult(data) {
2946
2977
  failed30d: numberValue(summary.failed_30d ?? summary.failed30d),
2947
2978
  external_delivered_30d: numberValue(summary.external_delivered_30d ?? summary.externalDelivered30d),
2948
2979
  externalDelivered30d: numberValue(summary.external_delivered_30d ?? summary.externalDelivered30d),
2980
+ nango_proofs_30d: numberValue(summary.nango_proofs_30d ?? summary.nangoProofs30d),
2981
+ nangoProofs30d: numberValue(summary.nango_proofs_30d ?? summary.nangoProofs30d),
2982
+ nango_failures_30d: numberValue(summary.nango_failures_30d ?? summary.nangoFailures30d),
2983
+ nangoFailures30d: numberValue(summary.nango_failures_30d ?? summary.nangoFailures30d),
2949
2984
  airbyte_configured: numberValue(summary.airbyte_configured ?? summary.airbyteConfigured),
2950
2985
  airbyteConfigured: numberValue(summary.airbyte_configured ?? summary.airbyteConfigured),
2951
2986
  airbyte_proofs_30d: numberValue(summary.airbyte_proofs_30d ?? summary.airbyteProofs30d),
@@ -3360,9 +3395,10 @@ function buildOpsDebugOptions(params) {
3360
3395
  }
3361
3396
  function buildCreateRoutineBody(params) {
3362
3397
  const { outputSinks, wakeOnEvents, ...rest } = params;
3398
+ const sinks = rest.output_sinks ?? outputSinks;
3363
3399
  return {
3364
3400
  ...rest,
3365
- output_sinks: rest.output_sinks ?? outputSinks,
3401
+ output_sinks: Array.isArray(sinks) ? sinks.map(normalizeOpsSinkRequest) : sinks,
3366
3402
  wake_on_events: rest.wake_on_events ?? wakeOnEvents
3367
3403
  };
3368
3404
  }
@@ -3396,6 +3432,97 @@ function buildCreateOutputSinkBody(params) {
3396
3432
  webhook_url: rest.webhook_url ?? webhookUrl
3397
3433
  };
3398
3434
  }
3435
+ function normalizeOpsSinkRequest(sink) {
3436
+ const {
3437
+ sinkId,
3438
+ connectionId,
3439
+ connectorId,
3440
+ connectorName,
3441
+ deliveryMode,
3442
+ providerConfigKey,
3443
+ integrationId,
3444
+ nangoConnectionId,
3445
+ actionName,
3446
+ nangoAction,
3447
+ proxyPath,
3448
+ nangoProxyPath,
3449
+ fieldMap,
3450
+ requiredFields,
3451
+ writeConfirmed,
3452
+ agentWriteConfirmed,
3453
+ config,
3454
+ ...rest
3455
+ } = sink;
3456
+ const normalizedConfig = normalizeOpsSinkConfigRequest(config);
3457
+ const connection_id = rest.connection_id ?? connectionId;
3458
+ const connector_id = rest.connector_id ?? connectorId;
3459
+ const delivery_mode = rest.delivery_mode ?? deliveryMode;
3460
+ const provider_config_key = rest.provider_config_key ?? providerConfigKey;
3461
+ const integration_id = rest.integration_id ?? integrationId;
3462
+ const nango_connection_id = rest.nango_connection_id ?? nangoConnectionId;
3463
+ const action_name = rest.action_name ?? actionName;
3464
+ const nango_action = rest.nango_action ?? nangoAction;
3465
+ const proxy_path = rest.proxy_path ?? proxyPath;
3466
+ const nango_proxy_path = rest.nango_proxy_path ?? nangoProxyPath;
3467
+ const field_map = rest.field_map ?? fieldMap;
3468
+ const required_fields = rest.required_fields ?? requiredFields;
3469
+ const write_confirmed = rest.write_confirmed ?? writeConfirmed;
3470
+ const agent_write_confirmed = rest.agent_write_confirmed ?? agentWriteConfirmed;
3471
+ if (connection_id !== void 0 && normalizedConfig.connection_id === void 0) normalizedConfig.connection_id = connection_id;
3472
+ if (connector_id !== void 0 && normalizedConfig.connector_id === void 0) normalizedConfig.connector_id = connector_id;
3473
+ if (delivery_mode !== void 0 && normalizedConfig.delivery_mode === void 0) normalizedConfig.delivery_mode = delivery_mode;
3474
+ if (provider_config_key !== void 0 && normalizedConfig.provider_config_key === void 0) normalizedConfig.provider_config_key = provider_config_key;
3475
+ if (integration_id !== void 0 && normalizedConfig.integration_id === void 0) normalizedConfig.integration_id = integration_id;
3476
+ if (nango_connection_id !== void 0 && normalizedConfig.nango_connection_id === void 0) normalizedConfig.nango_connection_id = nango_connection_id;
3477
+ if (action_name !== void 0 && normalizedConfig.action_name === void 0) normalizedConfig.action_name = action_name;
3478
+ if (nango_action !== void 0 && normalizedConfig.nango_action === void 0) normalizedConfig.nango_action = nango_action;
3479
+ if (proxy_path !== void 0 && normalizedConfig.proxy_path === void 0) normalizedConfig.proxy_path = proxy_path;
3480
+ if (nango_proxy_path !== void 0 && normalizedConfig.nango_proxy_path === void 0) normalizedConfig.nango_proxy_path = nango_proxy_path;
3481
+ if (field_map !== void 0 && normalizedConfig.field_map === void 0) normalizedConfig.field_map = field_map;
3482
+ if (required_fields !== void 0 && normalizedConfig.required_fields === void 0) normalizedConfig.required_fields = required_fields;
3483
+ if (write_confirmed !== void 0 && normalizedConfig.write_confirmed === void 0) normalizedConfig.write_confirmed = write_confirmed;
3484
+ if (agent_write_confirmed !== void 0 && normalizedConfig.agent_write_confirmed === void 0) normalizedConfig.agent_write_confirmed = agent_write_confirmed;
3485
+ if (sink.type === "nango" && normalizedConfig.integration_platform === void 0) normalizedConfig.integration_platform = "nango";
3486
+ return {
3487
+ ...rest,
3488
+ sink_id: rest.sink_id ?? sinkId,
3489
+ connection_id,
3490
+ connector_id,
3491
+ connector_name: rest.connector_name ?? connectorName,
3492
+ delivery_mode,
3493
+ provider_config_key,
3494
+ integration_id,
3495
+ nango_connection_id,
3496
+ action_name,
3497
+ nango_action,
3498
+ proxy_path,
3499
+ nango_proxy_path,
3500
+ field_map,
3501
+ required_fields,
3502
+ write_confirmed,
3503
+ agent_write_confirmed,
3504
+ config: normalizedConfig
3505
+ };
3506
+ }
3507
+ function normalizeOpsSinkConfigRequest(config) {
3508
+ const out = { ...config ?? {} };
3509
+ if (out.connection_id === void 0 && out.connectionId !== void 0) out.connection_id = out.connectionId;
3510
+ if (out.connector_id === void 0 && out.connectorId !== void 0) out.connector_id = out.connectorId;
3511
+ if (out.connector_name === void 0 && out.connectorName !== void 0) out.connector_name = out.connectorName;
3512
+ if (out.delivery_mode === void 0 && out.deliveryMode !== void 0) out.delivery_mode = out.deliveryMode;
3513
+ if (out.provider_config_key === void 0 && out.providerConfigKey !== void 0) out.provider_config_key = out.providerConfigKey;
3514
+ if (out.integration_id === void 0 && out.integrationId !== void 0) out.integration_id = out.integrationId;
3515
+ if (out.nango_connection_id === void 0 && out.nangoConnectionId !== void 0) out.nango_connection_id = out.nangoConnectionId;
3516
+ if (out.action_name === void 0 && out.actionName !== void 0) out.action_name = out.actionName;
3517
+ if (out.nango_action === void 0 && out.nangoAction !== void 0) out.nango_action = out.nangoAction;
3518
+ if (out.proxy_path === void 0 && out.proxyPath !== void 0) out.proxy_path = out.proxyPath;
3519
+ if (out.nango_proxy_path === void 0 && out.nangoProxyPath !== void 0) out.nango_proxy_path = out.nangoProxyPath;
3520
+ if (out.field_map === void 0 && out.fieldMap !== void 0) out.field_map = out.fieldMap;
3521
+ if (out.required_fields === void 0 && out.requiredFields !== void 0) out.required_fields = out.requiredFields;
3522
+ if (out.write_confirmed === void 0 && out.writeConfirmed !== void 0) out.write_confirmed = out.writeConfirmed;
3523
+ if (out.agent_write_confirmed === void 0 && out.agentWriteConfirmed !== void 0) out.agent_write_confirmed = out.agentWriteConfirmed;
3524
+ return out;
3525
+ }
3399
3526
  function buildApproveBody(params) {
3400
3527
  const { tokenId, tokenIds, reviewerNotes, ...rest } = params;
3401
3528
  return {
@@ -3544,6 +3671,57 @@ var GtmKernel = class {
3544
3671
  limit: options.limit
3545
3672
  });
3546
3673
  }
3674
+ /** Discover existing provider campaigns, starting with live/Kernel-linked Instantly campaigns, before audit or import preview. */
3675
+ async discoverExistingCampaigns(options = {}) {
3676
+ return this.callMcp("gtm_existing_campaign_discover", {
3677
+ provider: options.provider,
3678
+ integration_id: options.integrationId,
3679
+ search: options.search,
3680
+ limit: options.limit,
3681
+ include_kernel_linked: options.includeKernelLinked,
3682
+ include_provider_live: options.includeProviderLive
3683
+ });
3684
+ }
3685
+ /** Run a read-only existing campaign audit with completeness, recommendations, safe next MCP JSON, and approval boundaries. */
3686
+ async auditExistingCampaign(options) {
3687
+ return this.callMcp("gtm_existing_campaign_audit", {
3688
+ campaign_id: options.campaignId,
3689
+ provider: options.provider,
3690
+ provider_campaign_id: options.providerCampaignId,
3691
+ campaign_name: options.campaignName,
3692
+ days: options.days,
3693
+ include_route_preview: options.includeRoutePreview,
3694
+ include_memory: options.includeMemory,
3695
+ include_brain: options.includeBrain
3696
+ });
3697
+ }
3698
+ /** Discover the first matching existing provider campaign, then run the same read-only audit against that match. */
3699
+ async auditExistingCampaignBySearch(options) {
3700
+ const discovery = await this.discoverExistingCampaigns({
3701
+ provider: options.provider,
3702
+ integrationId: options.integrationId,
3703
+ search: options.search,
3704
+ limit: 1,
3705
+ includeKernelLinked: options.includeKernelLinked,
3706
+ includeProviderLive: options.includeProviderLive
3707
+ });
3708
+ const match = discovery.campaigns?.[0];
3709
+ const campaignId = match?.linked_kernel_campaign_id || void 0;
3710
+ const providerCampaignId = match?.provider_campaign_id || void 0;
3711
+ if (!campaignId && !providerCampaignId) {
3712
+ throw new Error(`No existing ${options.provider || discovery.provider || "provider"} campaign matched "${options.search}"`);
3713
+ }
3714
+ return this.auditExistingCampaign({
3715
+ provider: options.provider || discovery.provider || match?.provider,
3716
+ campaignId,
3717
+ providerCampaignId,
3718
+ campaignName: match?.name || match?.linked_kernel_campaign_name || void 0,
3719
+ days: options.days,
3720
+ includeRoutePreview: options.includeRoutePreview,
3721
+ includeMemory: options.includeMemory,
3722
+ includeBrain: options.includeBrain
3723
+ });
3724
+ }
3547
3725
  /** Create a first-class GTM campaign object in the current workspace. */
3548
3726
  async createCampaign(input) {
3549
3727
  return this.callMcp("gtm_campaign_create", campaignCreateArgs(input));
@@ -3749,6 +3927,47 @@ var GtmKernel = class {
3749
3927
  brain_cycle_min_interval_minutes: input.brainCycleMinIntervalMinutes
3750
3928
  });
3751
3929
  }
3930
+ /** Preview anonymized Instantly workspace sources registered for Kernel import. */
3931
+ async previewKernelImport(input = {}) {
3932
+ return this.callMcp("gtm_kernel_import_preview", {
3933
+ source_ids: input.sourceIds,
3934
+ include_leads: input.includeLeads,
3935
+ include_replies: input.includeReplies,
3936
+ include_private_copy: input.includePrivateCopy,
3937
+ max_pages: input.maxPages,
3938
+ limit: input.limit
3939
+ });
3940
+ }
3941
+ /** Queue the read-only Instantly-to-GTM Kernel import. Live writes require writeApproved. */
3942
+ async runKernelImport(input = {}) {
3943
+ return this.callMcp("gtm_kernel_import_run", {
3944
+ source_ids: input.sourceIds,
3945
+ dry_run: input.dryRun,
3946
+ write_approved: input.writeApproved,
3947
+ include_leads: input.includeLeads,
3948
+ include_replies: input.includeReplies,
3949
+ include_private_copy: input.includePrivateCopy,
3950
+ private_copy_approved: input.privateCopyApproved,
3951
+ promote_global_patterns: input.promoteGlobalPatterns,
3952
+ min_global_privacy_k: input.minGlobalPrivacyK,
3953
+ max_pages: input.maxPages,
3954
+ limit: input.limit
3955
+ });
3956
+ }
3957
+ /** Queue Brain distillation over imported Instantly memory with abstracted-only outputs. */
3958
+ async runBrainDistillation(input = {}) {
3959
+ return this.callMcp("gtm_brain_distill_run", {
3960
+ source_ids: input.sourceIds,
3961
+ write_mode: input.writeMode,
3962
+ write_approved: input.writeApproved,
3963
+ brain_cycle_phases: input.brainCyclePhases,
3964
+ days: input.days,
3965
+ network_days: input.networkDays,
3966
+ min_sample_size: input.minSampleSize,
3967
+ min_workspace_count: input.minWorkspaceCount,
3968
+ min_privacy_k: input.minPrivacyK
3969
+ });
3970
+ }
3752
3971
  /** Prepare a provider-agnostic feedback webhook URL for Smartlead, HeyReach, Airbyte, or custom sender events. */
3753
3972
  async prepareFeedbackWebhook(input) {
3754
3973
  return this.callMcp("gtm_feedback_webhook_prepare", {
@@ -4176,6 +4395,43 @@ var GtmKernel = class {
4176
4395
  context: input.context
4177
4396
  });
4178
4397
  }
4398
+ /** List Nango-backed action tools for a workspace connection without executing them. */
4399
+ async listNangoTools(options = {}) {
4400
+ return this.callMcp("nango_mcp_tools_list", {
4401
+ workspace_connection_id: options.workspaceConnectionId,
4402
+ connection_id: options.connectionId,
4403
+ provider_config_key: options.providerConfigKey,
4404
+ integration_id: options.integrationId,
4405
+ nango_connection_id: options.nangoConnectionId,
4406
+ format: options.format,
4407
+ include_raw: options.includeRaw
4408
+ });
4409
+ }
4410
+ /** Dry-run or execute a Nango-backed action tool through the approval-aware MCP bridge. */
4411
+ async callNangoTool(input) {
4412
+ return this.callMcp("nango_mcp_tool_call", {
4413
+ workspace_connection_id: input.workspaceConnectionId,
4414
+ connection_id: input.connectionId,
4415
+ provider_config_key: input.providerConfigKey,
4416
+ integration_id: input.integrationId,
4417
+ nango_connection_id: input.nangoConnectionId,
4418
+ action_name: input.actionName,
4419
+ tool_name: input.toolName,
4420
+ input: input.input,
4421
+ async: input.async,
4422
+ max_retries: input.maxRetries,
4423
+ dry_run: input.dryRun,
4424
+ confirm: input.confirm,
4425
+ confirm_write: input.confirmWrite
4426
+ });
4427
+ }
4428
+ /** Poll an async Nango action result by action id or status URL. */
4429
+ async getNangoActionResult(input) {
4430
+ return this.callMcp("nango_mcp_action_result_get", {
4431
+ action_id: input.actionId,
4432
+ status_url: input.statusUrl
4433
+ });
4434
+ }
4179
4435
  /** Deliver approved campaign-layer records to a webhook recipe, starting with Clay-style webhooks. */
4180
4436
  async deliverWebhook(input) {
4181
4437
  return this.callMcp("gtm_webhook_deliver", {
@@ -4310,6 +4566,59 @@ function compact2(value) {
4310
4566
  }
4311
4567
 
4312
4568
  // src/index.ts
4569
+ function inferMcpToolCategory(toolName) {
4570
+ if (typeof toolName !== "string" || !toolName) return void 0;
4571
+ if (toolName.startsWith("ops_") || toolName === "get_ops_readiness" || toolName === "get_gtm_ops_readiness" || toolName.startsWith("gtm_") || [
4572
+ "list_routines",
4573
+ "create_routine",
4574
+ "update_routine",
4575
+ "run_routine_now",
4576
+ "get_routine",
4577
+ "get_routine_ticks",
4578
+ "get_tick_items",
4579
+ "get_last_tick_items",
4580
+ "chain_routines",
4581
+ "get_chain_status",
4582
+ "launch_campaign",
4583
+ "quickstart_gtm_book",
4584
+ "list_campaigns",
4585
+ "campaign_performance",
4586
+ "tune_campaign",
4587
+ "emit_event",
4588
+ "approvals_list",
4589
+ "list_output_sinks",
4590
+ "create_output_sink",
4591
+ "update_output_sink",
4592
+ "delete_output_sink",
4593
+ "attach_sink_to_routine"
4594
+ ].includes(toolName)) {
4595
+ return "ops";
4596
+ }
4597
+ if ([
4598
+ "find_emails_with_verification",
4599
+ "verify_email",
4600
+ "enrich_company_signals",
4601
+ "company_intelligence",
4602
+ "find_contacts_with_email",
4603
+ "execute_primitive"
4604
+ ].includes(toolName)) {
4605
+ return "enrichment";
4606
+ }
4607
+ if (toolName.includes("icp")) return "icp";
4608
+ if (toolName.startsWith("ai_clean_")) return "data_cleaning";
4609
+ if (toolName.includes("system") || toolName.includes("workflow")) return "automation";
4610
+ if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
4611
+ return void 0;
4612
+ }
4613
+ function asRecord3(value) {
4614
+ return value && typeof value === "object" ? value : void 0;
4615
+ }
4616
+ function asStringArray(value) {
4617
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : void 0;
4618
+ }
4619
+ function asObjectSchema(value) {
4620
+ return asRecord3(value);
4621
+ }
4313
4622
  var Signaliz = class {
4314
4623
  constructor(config) {
4315
4624
  this.client = new HttpClient(config);
@@ -4368,21 +4677,21 @@ var Signaliz = class {
4368
4677
  const data = await this.client.mcp("tools/list", {});
4369
4678
  const tools = data?.tools ?? data ?? [];
4370
4679
  return tools.map((t) => ({
4371
- name: t.name,
4372
- description: (t.description ?? "").slice(0, 120),
4373
- category: t.annotations?.category,
4374
- costCredits: t.annotations?.cost_credits,
4375
- contractVersion: t.annotations?.contract_version ?? t.annotations?.contract?.contract_version,
4376
- permissionLevel: t.annotations?.permission_level ?? t.annotations?.contract?.permission_level,
4377
- authScopes: t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes,
4378
- idempotent: t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent,
4379
- destructive: t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive,
4380
- retryable: t.annotations?.retryable ?? t.annotations?.contract?.retryable,
4381
- rateLimitKey: t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key,
4382
- observability: t.annotations?.observability ?? t.annotations?.contract?.observability,
4383
- inputSchema: t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema,
4384
- outputSchema: t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema,
4385
- annotations: t.annotations
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)
4386
4695
  }));
4387
4696
  }
4388
4697
  /** Discover tools by natural language query */
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-L6XUFJJO.mjs";
4
+ } from "./chunk-EVZZQTWE.mjs";
5
5
 
6
6
  // src/mcp-config.ts
7
7
  import * as fs from "fs";
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@signaliz/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Signaliz SDK — GTM Kernel, Nango routes, MCP, and enrichment for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
- "signaliz": "./dist/cli.js",
10
- "signaliz-mcp": "./dist/mcp-config.js"
9
+ "signaliz": "dist/cli.js",
10
+ "signaliz-mcp": "dist/mcp-config.js"
11
11
  },
12
12
  "files": ["dist", "README.md"],
13
13
  "scripts": {
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://github.com/signaliz/sdk"
23
+ "url": "git+https://github.com/signaliz/sdk.git"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=18"