@carbonstopper/agent-mcp 0.1.48 → 0.1.50

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/tools.js CHANGED
@@ -439,7 +439,7 @@ const companyOrgSubjectUpdateItemSchema = companyOrgSubjectItemSchema.extend({
439
439
  superiorsShares: enterpriseOwnershipShare.describe("Optional updated superior ownership percentage, accepting a number or numeric string, for example 90 or \"75.5\". Omit it or pass a blank value to preserve the existing ownership percentage. Even when only changing this field, orgId and the current orgName are still required by the backend."),
440
440
  });
441
441
  const computationOrgSchema = z.object({
442
- orgId: longId.optional().describe("Existing organization subject id. If omitted, backend matches or creates by orgName."),
442
+ orgId: optionalWithoutBlank(longId).describe("Existing organization subject id. If omitted, blank, or null, backend matches or creates by orgName."),
443
443
  orgName: z.string().min(1).describe("Organization subject name. Required even when orgId is available so logs and responses remain understandable."),
444
444
  superiorsShares: enterpriseOwnershipShare.describe("Optional superior ownership percentage used when the backend creates a new organization subject because orgId is omitted. Accepts a number or numeric string; omit it to default to 100. It is ignored for an existing orgId."),
445
445
  });
@@ -541,9 +541,13 @@ const cbamWriteFields = {
541
541
  ...cbamReadFields,
542
542
  idempotencyKey: idempotencyKey.max(128),
543
543
  };
544
+ const cbamApprovalFields = {
545
+ confirmed: z.boolean().optional()
546
+ .describe("Trusted Agent wrapper approval flag. For high-risk actions the wrapper must inject true only after the existing LangGraph approval interrupt is approved."),
547
+ };
544
548
  const cbamConfirmedWriteFields = {
545
549
  ...cbamWriteFields,
546
- ...confirmedActionFields,
550
+ ...cbamApprovalFields,
547
551
  };
548
552
  const cbamReferenceType = z.enum([
549
553
  "ORGANIZATION",
@@ -628,7 +632,7 @@ const cbamReportForm = z.object({
628
632
  verification: cbamVerification.optional().describe("Optional verification organization information. Omit on update to preserve the current verification record."),
629
633
  });
630
634
  const cbamProcessDefinition = z.object({
631
- id: longId.optional().describe("Existing process id for update. Omit to create a new process."),
635
+ id: optionalWithoutBlank(longId).describe("Existing process id for update. Omit it, or pass a blank/null placeholder, to create a new process."),
632
636
  processName: z.string().trim().min(1).max(200),
633
637
  productCategoryId: longId.describe("Product category id returned by cbam_reference_search."),
634
638
  preId: z.string().optional().describe("Comma-separated preceding process ids from this report. Use an empty string to clear."),
@@ -639,7 +643,7 @@ const cbamProcessDefinition = z.object({
639
643
  includeType: cbamZeroOne.optional().describe("Production-route selection mode: 0=automatic, 1=manual."),
640
644
  });
641
645
  const cbamPrecursorDefinition = z.object({
642
- id: longId.optional().describe("Existing precursor id for update. Omit to create a new precursor."),
646
+ id: optionalWithoutBlank(longId).describe("Existing precursor id for update. Omit it, or pass a blank/null placeholder, to create a new precursor."),
643
647
  preName: z.string().trim().min(1).max(200),
644
648
  productCategoryId: longId.describe("Product category id returned by cbam_reference_search."),
645
649
  countryCode: z.string().max(100).optional().describe("Country dictionary value returned by cbam_reference_search; omit or clear when not yet known."),
@@ -647,7 +651,7 @@ const cbamPrecursorDefinition = z.object({
647
651
  productRoute: z.string().optional().describe("Comma-separated default-process route ids returned by cbam_reference_search."),
648
652
  });
649
653
  const cbamSourceFlow = z.object({
650
- id: longId.optional().describe("Existing source-flow id for update. Omit to create a new row."),
654
+ id: optionalWithoutBlank(longId).describe("Existing source-flow id for update. Omit it, or pass a blank/null placeholder, to create a new row."),
651
655
  productProcessId: longId.describe("Owning process id from the same report."),
652
656
  processMethod: cbamCode.describe("Process-method code returned by CBAM_ENUM reference data."),
653
657
  sourceType: cbamCode.describe("Source-flow type code returned by CBAM_ENUM reference data."),
@@ -684,7 +688,7 @@ const cbamActivityRow = z.object({
684
688
  emission: nonNegativeNumericValue.describe("Activity amount for this route row."),
685
689
  });
686
690
  const cbamProductAttribution = z.object({
687
- id: longId.optional().describe("Existing attribution id returned by cbam_report_read. Omit for a new row."),
691
+ id: optionalWithoutBlank(longId).describe("Existing attribution id returned by cbam_report_read. Omit it, or pass a blank/null placeholder, for a new row."),
688
692
  emissionElement: cbamCode.describe("Emission-element code returned by CBAM_ENUM reference data."),
689
693
  isExists: cbamCode.describe("Whether this emission element is included; use the exact CBAM_ENUM code."),
690
694
  inputPower: nonNegativeNumericValue.optional(),
@@ -694,11 +698,11 @@ const cbamProductAttribution = z.object({
694
698
  emissionSource: cbamCode.optional(),
695
699
  eleSource: z.string().max(100).optional(),
696
700
  eleChoose: cbamCode.optional(),
697
- defaultCnId: longId.optional(),
701
+ defaultCnId: optionalWithoutBlank(longId),
698
702
  cnCode: z.string().max(100).optional(),
699
703
  });
700
704
  const cbamElectricityCalculator = z.object({
701
- id: longId.optional(),
705
+ id: optionalWithoutBlank(longId),
702
706
  eleValue: nonNegativeNumericValue,
703
707
  coefficient: nonNegativeNumericValue,
704
708
  });
@@ -721,7 +725,7 @@ const cbamPrecursorProductData = z.object({
721
725
  productAttributionList: z.array(cbamProductAttribution).max(100).optional(),
722
726
  }).describe("Complete activity/emission data for one existing precursor. The backend rejects an unbalanced item.");
723
727
  const cbamSaleProduct = z.object({
724
- id: longId.optional().describe("Existing sale-product id for update. Omit to create."),
728
+ id: optionalWithoutBlank(longId).describe("Existing sale-product id for update. Omit it, or pass a blank/null placeholder, to create."),
725
729
  cnCode: z.string().trim().min(1).max(100).describe("CN code valid for the selected process product category."),
726
730
  processId: longId.describe("Owning process id from the same report."),
727
731
  productName: z.string().trim().min(1).max(200),
@@ -749,15 +753,15 @@ const cbamSaleProduct = z.object({
749
753
  organic: nonNegativeNumericValue.optional(),
750
754
  });
751
755
  const cbamCarbonTax = z.object({
752
- id: longId.optional().describe("Existing carbon-tax row id for update. Omit to create."),
756
+ id: optionalWithoutBlank(longId).describe("Existing carbon-tax row id for update. Omit it, or pass a blank/null placeholder, to create."),
753
757
  saleProductId: longId.describe("Sale-product id from the same report."),
754
758
  reportSelected: cbamZeroOne.optional(),
755
759
  emissionValueType: cbamCode.optional(),
756
760
  emissionSourceType: cbamCode.optional(),
757
- emissionSourceSaleProductId: longId.optional(),
758
- emissionSourceDefaultCnId: longId.optional(),
761
+ emissionSourceSaleProductId: optionalWithoutBlank(longId),
762
+ emissionSourceDefaultCnId: optionalWithoutBlank(longId),
759
763
  emissionSourceYear: z.number().int().min(1900).max(9999).optional(),
760
- productBenchmarkId: longId.optional(),
764
+ productBenchmarkId: optionalWithoutBlank(longId),
761
765
  productBenchmarkType: cbamCode.optional(),
762
766
  cbamAdjustmentFactor: nonNegativeNumericValue.optional(),
763
767
  paidCarbonPrice: nonNegativeNumericValue.optional(),
@@ -789,8 +793,8 @@ export const schemas = {
789
793
  types: z.array(cbamReferenceType).min(1).max(12)
790
794
  .describe("Only the reference-data families needed for the current step. CARBON_TAX_CANDIDATE additionally requires reportId."),
791
795
  keyword: z.string().trim().max(200).optional(),
792
- orgId: longId.optional(),
793
- reportId: longId.optional(),
796
+ orgId: optionalWithoutBlank(longId),
797
+ reportId: optionalWithoutBlank(longId),
794
798
  limit: z.number().int().min(1).max(200).optional(),
795
799
  pageNum: z.number().int().min(1).optional(),
796
800
  pageSize: z.number().int().min(1).max(200).optional(),
@@ -798,8 +802,8 @@ export const schemas = {
798
802
  cbam_report_search: z.object({
799
803
  ...cbamReadFields,
800
804
  reportName: z.string().trim().max(200).optional(),
801
- orgId: longId.optional(),
802
- factoryId: longId.optional(),
805
+ orgId: optionalWithoutBlank(longId),
806
+ factoryId: optionalWithoutBlank(longId),
803
807
  year: z.number().int().min(1900).max(9999).optional(),
804
808
  pageNum: z.number().int().min(1).optional(),
805
809
  pageSize: z.number().int().min(1).max(100).optional(),
@@ -811,7 +815,7 @@ export const schemas = {
811
815
  .describe("Read mode. snapshot=whole workflow overview; section=one form section; item=one child record; result=result summary; readiness=generation blockers; carbon_tax_status=asynchronous tax calculation status."),
812
816
  section: cbamSection.optional().describe("Required only when view=section."),
813
817
  itemType: cbamItemType.optional().describe("Required only when view=item."),
814
- itemId: longId.optional().describe("Required only when view=item; must belong to reportId."),
818
+ itemId: optionalWithoutBlank(longId).describe("Required only when view=item; must belong to reportId. Blank/null placeholders are omitted for other views."),
815
819
  }),
816
820
  cbam_factory_read: z.object({
817
821
  ...cbamReadFields,
@@ -820,19 +824,19 @@ export const schemas = {
820
824
  cbam_factory_save: z.object({
821
825
  ...cbamConfirmedWriteFields,
822
826
  action: z.enum(["create", "update"]),
823
- factoryId: longId.optional().describe("Required for action=update and omitted for action=create."),
827
+ factoryId: optionalWithoutBlank(longId).describe("Required for action=update and omitted for action=create. Blank or null create placeholders are treated as omitted."),
824
828
  factory: cbamFactoryForm.describe("Complete factory form. For update, first call cbam_factory_read and preserve unchanged fields and orgId."),
825
829
  }),
826
830
  cbam_report_save: z.object({
827
831
  ...cbamWriteFields,
828
832
  action: z.enum(["create", "update"]),
829
- reportId: longId.optional().describe("Required for action=update and omitted for action=create."),
833
+ reportId: optionalWithoutBlank(longId).describe("Required for action=update and omitted for action=create. Blank or null create placeholders are treated as omitted."),
830
834
  report: cbamReportForm.describe("Complete CBAM general-information form."),
831
835
  }),
832
836
  cbam_process_manage: z.object({
833
837
  ...cbamConfirmedWriteFields,
834
838
  reportId: longId,
835
- action: z.enum(["save", "delete", "reorder"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM; reorder requires the complete ordered ids list and forbids items."),
839
+ action: z.enum(["save", "delete", "reorder"]).describe("save requires items and forbids ids; delete requires prior Agent approval and confirmed=true; reorder requires the complete ordered ids list and forbids items."),
836
840
  items: z.array(cbamProcessDefinition).min(1).max(10).optional()
837
841
  .describe("Required only for action=save. The report can contain at most 10 processes."),
838
842
  ids: z.array(longId).min(1).max(10).optional()
@@ -841,7 +845,7 @@ export const schemas = {
841
845
  cbam_precursor_manage: z.object({
842
846
  ...cbamConfirmedWriteFields,
843
847
  reportId: longId,
844
- action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM."),
848
+ action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids plus prior Agent approval and confirmed=true."),
845
849
  items: z.array(cbamPrecursorDefinition).min(1).max(20).optional()
846
850
  .describe("Required only for action=save. The report can contain at most 20 manually entered precursors."),
847
851
  ids: z.array(longId).min(1).max(20).optional().describe("Required only for action=delete."),
@@ -849,7 +853,7 @@ export const schemas = {
849
853
  cbam_source_flow_manage: z.object({
850
854
  ...cbamConfirmedWriteFields,
851
855
  reportId: longId,
852
- action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM."),
856
+ action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids plus prior Agent approval and confirmed=true."),
853
857
  items: z.array(cbamSourceFlow).min(1).max(200).optional().describe("Required only for action=save."),
854
858
  ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
855
859
  }),
@@ -868,14 +872,14 @@ export const schemas = {
868
872
  cbam_sale_product_manage: z.object({
869
873
  ...cbamConfirmedWriteFields,
870
874
  reportId: longId,
871
- action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids and uses WAIT_CONFIRM."),
875
+ action: z.enum(["save", "delete"]).describe("save requires items and forbids ids; delete requires ids plus prior Agent approval and confirmed=true."),
872
876
  items: z.array(cbamSaleProduct).min(1).max(100).optional().describe("Required only for action=save."),
873
877
  ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
874
878
  }),
875
879
  cbam_carbon_tax_manage: z.object({
876
880
  ...cbamConfirmedWriteFields,
877
881
  reportId: longId,
878
- action: z.enum(["save", "delete", "calculate"]).describe("save requires items; delete requires ids and WAIT_CONFIRM; calculate forbids items/ids and uses WAIT_CONFIRM."),
882
+ action: z.enum(["save", "delete", "calculate"]).describe("save requires items; delete requires ids; calculate forbids items/ids. delete/calculate require prior Agent approval and confirmed=true."),
879
883
  items: z.array(cbamCarbonTax).min(1).max(100).optional().describe("Required only for action=save."),
880
884
  ids: z.array(longId).min(1).max(100).optional().describe("Required only for action=delete."),
881
885
  }),
@@ -1255,7 +1259,7 @@ export const schemas = {
1255
1259
  sessionId,
1256
1260
  ...skillTraceFields,
1257
1261
  year: enterpriseYear,
1258
- orgId: longId.optional().describe("Optional organization subject id. Omit to return all subjects under the year."),
1262
+ orgId: optionalWithoutBlank(longId).describe("Optional organization subject id. Omit it, or pass a blank/null placeholder, to return all subjects under the year."),
1259
1263
  computationPeriod: z.string().optional().describe("Optional computation period filter. For annual accounting this is usually omitted or the year string."),
1260
1264
  }),
1261
1265
  enterprise_computation_period_list: z.object({
@@ -1359,7 +1363,6 @@ export const exposedToolNames = [
1359
1363
  "cbam_carbon_tax_manage",
1360
1364
  "cbam_data_quality_update",
1361
1365
  "cbam_report_generate",
1362
- "cbam_report_generation_status",
1363
1366
  "user_memory_recall",
1364
1367
  "user_memory_get",
1365
1368
  "user_memory_upsert",
@@ -1420,19 +1423,19 @@ export const descriptions = {
1420
1423
  cbam_reference_search: "Read CBAM reference data needed for the current step: accessible organizations and factories, countries, currencies, enum codes, product categories, default processes/precursors/products/CN/sale data, or report-scoped carbon-tax candidates. Request only needed types. Use returned ids/codes exactly and never invent dictionary or organization values. CARBON_TAX_CANDIDATE requires reportId. Large reference tables are paginated with pageNum/pageSize. Read-only.",
1421
1424
  cbam_report_search: "Search CBAM reports accessible to the current user by optional name, organization, factory, year, and pagination. Use this or session_carbon_objects to resolve an exact reportId. A single Agent session can create and work with multiple CBAM reports; never silently select the first result when several reports match. Read-only.",
1422
1425
  cbam_report_read: "Unified read-only CBAM report inspection. view=snapshot returns workflow overview/counts/readiness; section returns one complete editable section and requires section; item reads one child record and requires itemType+itemId; result returns result analysis; readiness returns generation blockers/warnings; carbon_tax_status returns asynchronous carbon-tax calculation state. itemId must belong to reportId. Call the corresponding read view before a full-form update so unchanged fields are preserved.",
1423
- cbam_factory_read: "Read the complete accessible CBAM factory form by exact factoryId. Call before updating a shared factory because factory updates are full-form writes and orgId is immutable. Read-only.",
1424
- cbam_factory_save: "Create or fully update a shared CBAM factory. action=create omits factoryId; action=update requires factoryId and must follow cbam_factory_read, preserving unchanged fields and orgId. Country and orgId must come from cbam_reference_search. Both actions are shared-data mutations and use the backend WAIT_CONFIRM two-step flow: first call without confirmed, then repeat the identical payload/idempotencyKey with confirmed=true and the returned pendingActionId after user confirmation. MCP never automatically retries this write.",
1426
+ cbam_factory_read: "Read the complete accessible CBAM factory form by exact factoryId. Terminology rule: in every Chinese response, card, and confirmation, call this object ‘CBAM 工厂’ or ‘工厂’; never translate factory as ‘设施’. Call before updating a shared factory because factory updates are full-form writes and orgId is immutable. Read-only.",
1427
+ cbam_factory_save: "Create or fully update a shared CBAM factory. Terminology rule: in every Chinese response, card, and approval confirmation, call this action ‘创建 CBAM 工厂’ or ‘更新 CBAM 工厂’; never say ‘创建设施’, ‘更新设施’, or use ‘设施’ as the object name. action=create omits factoryId; action=update requires factoryId and must follow cbam_factory_read, preserving unchanged fields and orgId. Country and orgId must come from cbam_reference_search. Both actions are shared-data mutations: reuse the existing Agent approval interrupt, then have the trusted wrapper inject confirmed=true and idempotencyKey before this single MCP call. The approval covers only the factory mutation and does not include creating a CBAM report. MCP never automatically retries this write.",
1425
1428
  cbam_report_save: "Create or fully update CBAM report general information. action=create omits reportId; every create call creates a NEW report and binds it to the same Agent session without replacing earlier CBAM reports. One session may therefore contain multiple reports. action=update requires an explicit reportId and should follow cbam_report_read view=section section=GENERAL_INFO. After more than one report exists, always pass the intended reportId to subsequent tools and ask the user when context is ambiguous. Basic general information is enough to create a report and later generate it; other sections are progressive supplements. Requires idempotencyKey.",
1426
- cbam_process_manage: "Manage self-produced CBAM process definitions for one report. action=save batch-creates/updates complete definition rows; action=delete removes exact ids; action=reorder requires every current process id exactly once in target order. Read PROCESS before updates/deletes/reorder. A report supports at most 10 processes. Delete uses WAIT_CONFIRM and must repeat the identical request with returned pendingActionId after confirmation. Requires idempotencyKey; MCP never automatically retries.",
1427
- cbam_precursor_manage: "Manage manually entered purchased-precursor definitions. action=save batch-creates/updates complete rows; action=delete removes exact precursor ids. Read PRECURSOR first, and resolve category/country/route values through cbam_reference_search. A report supports at most 20 precursors. Delete uses WAIT_CONFIRM. Requires idempotencyKey; MCP never automatically retries.",
1428
- cbam_source_flow_manage: "Manage direct-emission source-flow rows under report processes. action=save creates/updates rows and the backend recalculates direct emissions; action=delete removes exact ids. Read SOURCE_FLOW first, use process ids from the same report, and use CBAM_ENUM codes for processMethod/sourceType. Calculated results and support files are backend-owned and are not accepted by this tool. Delete uses WAIT_CONFIRM. Requires idempotencyKey.",
1429
+ cbam_process_manage: "Manage self-produced CBAM process definitions for one report. action=save batch-creates/updates complete definition rows; action=delete removes exact ids; action=reorder requires every current process id exactly once in target order. Read PROCESS before updates/deletes/reorder. A report supports at most 10 processes. Delete requires the existing Agent approval interrupt and wrapper-injected confirmed=true; save/reorder do not. Requires idempotencyKey; MCP never automatically retries.",
1430
+ cbam_precursor_manage: "Manage manually entered purchased-precursor definitions. action=save batch-creates/updates complete rows; action=delete removes exact precursor ids. Read PRECURSOR first, and resolve category/country/route values through cbam_reference_search. A report supports at most 20 precursors. Delete requires prior Agent approval and wrapper-injected confirmed=true. Requires idempotencyKey; MCP never automatically retries.",
1431
+ cbam_source_flow_manage: "Manage direct-emission source-flow rows under report processes. action=save creates/updates rows and the backend recalculates direct emissions; action=delete removes exact ids. Read SOURCE_FLOW first, use process ids from the same report, and use CBAM_ENUM codes for processMethod/sourceType. Calculated results and support files are backend-owned and are not accepted by this tool. Delete requires prior Agent approval and wrapper-injected confirmed=true. Requires idempotencyKey.",
1429
1432
  cbam_heat_power_update: "Update complete heat-power cogeneration inputs for a report whose include flag enables this section. Read HEAT_POWER first. Submit only input fields; the backend calculates outPower/outFactor and invalidates dependent sale calculations. Requires idempotencyKey.",
1430
1433
  cbam_product_data_update: "Update product activity/emission data for existing process or precursor rows. dataType=process requires process items with totalVolume and salesVolume; dataType=precursor requires precursor items. Read PROCESS_PRODUCT_DATA or PRECURSOR_PRODUCT_DATA first. The backend preserves definitions, validates report ownership and activity balances, replaces route rows transactionally, calculates dependent fields, and rejects server-owned result fields. Requires idempotencyKey.",
1431
- cbam_sale_product_manage: "Manage sale products for one CBAM report. action=save batch-creates/updates complete form rows tied to exact report process ids; action=delete removes exact ids and dependent tax rows. Read SALE_PRODUCT first and use CN/category data from cbam_reference_search. Calculated emissions, versions, fill status, and payTax are backend-owned. Delete uses WAIT_CONFIRM. Requires idempotencyKey.",
1432
- cbam_carbon_tax_manage: "Manage or calculate report carbon tax. action=save batch-creates/updates rows using exact saleProductId, currency, benchmark, and source candidates returned by CBAM reads/reference search; action=delete removes exact ids; action=calculate starts asynchronous calculation. Read CARBON_TAX and carbon-tax candidates first. delete and calculate use WAIT_CONFIRM; after calculate succeeds, poll cbam_report_read with view=carbon_tax_status. Requires idempotencyKey and is never automatically retried.",
1434
+ cbam_sale_product_manage: "Manage sale products for one CBAM report. action=save batch-creates/updates complete form rows tied to exact report process ids; action=delete removes exact ids and dependent tax rows. Read SALE_PRODUCT first and use CN/category data from cbam_reference_search. Calculated emissions, versions, fill status, and payTax are backend-owned. Delete requires prior Agent approval and wrapper-injected confirmed=true. Requires idempotencyKey.",
1435
+ cbam_carbon_tax_manage: "Manage or calculate report carbon tax. action=save batch-creates/updates rows using exact saleProductId, currency, benchmark, and source candidates returned by CBAM reads/reference search; action=delete removes exact ids; action=calculate starts asynchronous calculation. Read CARBON_TAX and carbon-tax candidates first. delete and calculate require the existing Agent approval interrupt and wrapper-injected confirmed=true; after calculate succeeds, poll cbam_report_read with view=carbon_tax_status. Requires idempotencyKey and is never automatically retried.",
1433
1436
  cbam_data_quality_update: "Update the complete CBAM data-quality form. First call cbam_report_read view=section section=DATA_QUALITY and preserve fields the user did not change. Use CBAM_ENUM codes for enum fields. Requires idempotencyKey.",
1434
- cbam_report_generate: "Start backend generation of the selected CBAM report file. General information alone is sufficient to request generation; optional missing sections remain visible through cbam_report_read view=readiness and may produce warnings or incomplete content according to backend rules. The backend creates the file, uploads it, and records it in Carbon Cloud download management; the Agent must not create a parallel spreadsheet. This costly asynchronous action uses WAIT_CONFIRM. After confirmation repeat the identical payload/idempotencyKey with confirmed=true and pendingActionId, then poll cbam_report_generation_status using returned generationId. Timeout/network/5xx failures are not automatically retried.",
1435
- cbam_report_generation_status: "Poll one CBAM report-generation task using the exact reportId and generationId returned by cbam_report_generate. Returns RUNNING, COMPLETED, or FAILED plus the generated download record/path when available. Read-only.",
1437
+ cbam_report_generate: "Generate the selected CBAM report and wait for the backend file result. General information alone is sufficient to request generation; optional missing sections remain visible through cbam_report_read view=readiness and may produce warnings or incomplete content according to backend rules. The backend creates the file, uploads it, and records it in Carbon Cloud download management; the Agent must not create a parallel spreadsheet. Reuse the existing Agent approval interrupt, then have the trusted wrapper inject confirmed=true and idempotencyKey before this single MCP call. The MCP server polls the internal generation status itself and normally returns COMPLETED with the download file. If it returns RUNNING with timedOut=true, call this same tool again with the same idempotencyKey to continue waiting without creating a duplicate task. The generation write is never automatically retried after timeout/network/5xx failures.",
1438
+ cbam_report_generation_status: "Internal-only CBAM report-generation status route used by cbam_report_generate. It is intentionally not exposed to the Agent.",
1436
1439
  user_memory_recall: "Recall the current user's stored cross-session preferences, long-term constraints, carbon-domain habits, and response-style preferences. Call this when stable prior preferences can materially improve the current task, when the user asks what was remembered, and before user_memory_upsert or user_memory_forget if this turn has not already recalled the same target topic. A direct write or forget needs this lookup even when the current request supplies the new value, so the Agent can reuse an existing memoryKey and memoryId instead of creating a semantic duplicate. Do not repeatedly recall the same topic in one turn. Write query as a concise question about the preference or constraint needed now; never copy the full user message or include unrelated sensitive business data. Optional memoryTypes: preference=general preference, constraint=persistent rule or boundary, domain_habit=carbon-accounting/modeling/reporting workflow habit, format_habit=response language/structure/length/file-format habit. The response contains rules and items with memoryId, scope, type, memoryKey, normalized content, recallMode, version, and relevance metadata. count=0 is a successful empty recall; continue the task using current context. The current user request always overrides recalled memory, and current business data is authoritative. Treat recalled items as guidance, not authoritative business facts. Never reveal memory ids, versions, scores, source metadata, or internal implementation details to the user. Requires sessionId, a messageId belonging to that session, and query.",
1437
1440
  user_memory_get: "Read exactly one current-user memory by the stable memoryId returned by user_memory_recall or a previous write. Use this immediately before updating or forgetting a memory to obtain its latest version and avoid stale writes. Do not enumerate, guess, or probe memory ids, and do not use this tool to access another user or project: authorization is derived from sessionId and messageId. The response is reduced to Agent-safe fields and must not be displayed as internal metadata to the user. Requires sessionId, a messageId belonging to that session, and memoryId.",
1438
1441
  user_memory_upsert: "Create or update one stable long-term user memory. Call only when the user explicitly asks the Agent to remember a lasting preference/constraint, or after the user clearly confirms it; ordinary observations, one-off task details, sensitive data, changing business facts, account ids, emission values, and unconfirmed model inferences must not be stored. Before writing, call user_memory_recall once for the target topic unless the same topic was already recalled in this turn. If recall finds the same independently updatable slot, reuse its exact memoryKey; for an exact update, also reuse its memoryId, call user_memory_get, and preferably pass the latest positive version as expectedVersion. If recall finds no matching slot, omit memoryId and create by a new stable memoryKey. memoryId determines the operation: omit it or pass a blank value to create/upsert by memoryKey; pass a valid memoryId to update that exact item. For compatibility, expectedVersion may be omitted or 0 and the backend will use the latest version read at update time; never blindly retry a version conflict. expectedVersion is ignored when memoryId is absent. memoryKey represents one independently updatable slot: never include mutable attitude/state such as like/dislike or enabled/disabled. A single-valued attribute uses one fixed key without the changing value, such as preference.favorite_color or format.response.language. A multi-valued collection includes a canonical lowercase English object so values can coexist, such as preference.color.white and preference.color.red; liking and disliking white both reuse preference.color.white. Different wording or languages for the same slot or object must reuse the recalled key. USER applies across sessions; USER_PROJECT applies only to the current session project, which the backend derives automatically. Prefer source=EXPLICIT_USER for a direct request or CONFIRMED_CONVERSATION after confirmation. Use ALWAYS for persistent constraints/response-style rules and SEMANTIC for context-dependent preferences, or omit recallMode for the backend default. Requires sessionId, messageId, scope, type, memoryKey, and normalized content no longer than 120 characters. MCP never automatically retries this write.",
@@ -1623,13 +1626,17 @@ export const toolRoutes = {
1623
1626
  method: "POST",
1624
1627
  path: apipath.CbamReportGenerate(),
1625
1628
  bodyKind: "cbam",
1626
- timeoutSeconds: 120,
1629
+ // This endpoint only creates the asynchronous generation task. The MCP
1630
+ // composite call owns a separate 120-second total start-and-poll budget.
1631
+ timeoutSeconds: 20,
1632
+ exactTimeout: true,
1627
1633
  maxRetries: 0,
1628
1634
  },
1629
1635
  cbam_report_generation_status: {
1630
1636
  method: "POST",
1631
1637
  path: apipath.CbamReportGenerationStatus(),
1632
1638
  bodyKind: "cbam",
1639
+ maxRetries: 0,
1633
1640
  },
1634
1641
  user_memory_recall: {
1635
1642
  method: "POST",
@@ -1978,7 +1985,6 @@ export function buildBody(route, args) {
1978
1985
  || action === "calculate";
1979
1986
  if (!confirmationRequired) {
1980
1987
  delete body.confirmed;
1981
- delete body.pendingActionId;
1982
1988
  }
1983
1989
  return normalizeCbamCodes(normalizeIds(pickDefined(body)));
1984
1990
  }
@@ -2407,11 +2413,11 @@ function validateCbamActionPayload(args, supported) {
2407
2413
  }
2408
2414
  }
2409
2415
  function validateCbamConfirmation(args, required) {
2410
- if (!required || args.confirmed !== true)
2416
+ if (!required)
2411
2417
  return;
2412
- if (typeof args.pendingActionId !== "string" || args.pendingActionId.trim().length === 0) {
2413
- cbamInputError("PENDING_ACTION_ID_REQUIRED", "pendingActionId", "pendingActionId returned by WAIT_CONFIRM is required when confirmed=true");
2414
- }
2418
+ if (args.confirmed === true)
2419
+ return;
2420
+ cbamInputError("CONFIRMATION_REQUIRED", "confirmed", "confirmed=true must be injected by the trusted Agent wrapper after user approval");
2415
2421
  }
2416
2422
  function validateCbamSourceFlows(value) {
2417
2423
  if (!Array.isArray(value))