@carbonstopper/agent-mcp 0.1.45 → 0.1.47
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/AGENTS.md +2 -0
- package/README.md +53 -10
- package/dist/apipath.d.ts +31 -0
- package/dist/apipath.js +33 -0
- package/dist/apipath.js.map +1 -1
- package/dist/logger.js +29 -6
- package/dist/logger.js.map +1 -1
- package/dist/response.js +5 -5
- package/dist/response.js.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +896 -11
- package/dist/tools.js.map +1 -1
- package/docs/cbam2-agent-integration-guide.md +937 -0
- package/docs/schema-audit.md +32 -11
- package/package.json +1 -1
package/docs/schema-audit.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MCP Tool Schema Audit
|
|
2
2
|
|
|
3
|
-
Audit date: 2026-08-
|
|
3
|
+
Audit date: 2026-08-12
|
|
4
4
|
|
|
5
5
|
Scope: the `tools/list.inputSchema` contract and deterministic MCP-side validation in `carbonstop-agent-mcp`. Database existence, session ownership, permissions, current record state, and relationships between persisted ids remain authoritative backend checks.
|
|
6
6
|
|
|
@@ -9,11 +9,11 @@ Scope: the `tools/list.inputSchema` contract and deterministic MCP-side validati
|
|
|
9
9
|
| Baseline | Version | Tools | Payload | `anyOf` | `oneOf` | `allOf` | `not` | `if` | `then` |
|
|
10
10
|
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
|
11
11
|
| Test endpoint before this change | 0.1.38 | 39 | 174,877 bytes | 78 | 0 | 0 | 0 | 0 | 0 |
|
|
12
|
-
| Local working tree | 0.1.
|
|
12
|
+
| Local working tree | 0.1.46 | 71 | 283,179 bytes | 321 | 0 | 4 | 31 | 7 | 7 |
|
|
13
13
|
|
|
14
|
-
The local tool count includes four `project_memory_*` tools, eleven `project_*` runtime-read tools,
|
|
14
|
+
The local tool count includes four `project_memory_*` tools, eleven `project_*` runtime-read tools, the confirmed `project_enterprise_task_create` write tool, and sixteen task-oriented `cbam2_*` tools. Those sixteen tools route to all 31 CBAM2 Java atomic endpoints. The local payload is measured with `Buffer.byteLength(JSON.stringify(await client.listTools()))`; it excludes HTTP/SSE framing and is not a model-token count. The older test-endpoint baseline preserves its original endpoint-response measurement, so use that comparison as directional rather than byte-for-byte.
|
|
15
15
|
|
|
16
|
-
Some optional fields retain MCP-side blank/null-to-omitted normalization for compatibility with older callers.
|
|
16
|
+
Some optional fields retain MCP-side blank/null-to-omitted normalization for compatibility with older callers. For those fields, the public Schema advertises the tolerated placeholders so strict MCP clients and server-side normalization agree. Agents should still prefer omission over generating blank or null values.
|
|
17
17
|
|
|
18
18
|
## Status Legend
|
|
19
19
|
|
|
@@ -27,7 +27,23 @@ Some optional fields retain MCP-side blank/null-to-omitted normalization for com
|
|
|
27
27
|
|
|
28
28
|
| Tool | Mode | Public contract and audit result | Residual owner |
|
|
29
29
|
|---|---|---|---|
|
|
30
|
-
| `session_carbon_objects` | Read | **Covered**: `sessionId`; optional module enum. | **State**: session-bound computations. |
|
|
30
|
+
| `session_carbon_objects` | Read | **Covered**: `sessionId`; optional `all/footprint3/enterprise/cbam2` module enum. | **State**: session-bound accounts/computations/reports; one session may contain multiple CBAM2 reports. |
|
|
31
|
+
| `cbam2_reference_search` | Read | **Covered/Contract**: reference-type enum, bounds, unique types; report id required for tax candidates. | **State**: organization visibility, dictionaries, report-scoped candidates. |
|
|
32
|
+
| `cbam2_report_search` | Read | **Covered**: typed optional filters and pagination. | **Workflow/State**: user selection when multiple reports match; report visibility. |
|
|
33
|
+
| `cbam2_report_read` | Read | **Contract**: unified view enum; section and item dependencies; exact report/item ids. | **State**: report visibility and child ownership. |
|
|
34
|
+
| `cbam2_factory_read` | Read | **Covered**: exact factory id. | **State**: company and organization visibility. |
|
|
35
|
+
| `cbam2_factory_save` | Write | **Contract**: create/update action, conditional factory id, complete form, idempotency, confirmed retry requires pending action id; no automatic retry. | **State/Workflow**: shared-data WAIT_CONFIRM, immutable org, dictionary/code uniqueness. |
|
|
36
|
+
| `cbam2_report_save` | Write | **Contract**: create/update action, conditional report id, complete base form, exact calendar range, idempotency. | **Workflow/State**: every create adds a new session-bound report; organization/factory visibility. |
|
|
37
|
+
| `cbam2_process_manage` | Write | **Contract**: save/delete/reorder action payloads, unique ids, limits, delete confirmation. | **State**: dependencies, references, complete reorder set, report ownership. |
|
|
38
|
+
| `cbam2_precursor_manage` | Write | **Contract**: save/delete payloads, unique ids, limits, delete confirmation. | **State**: category/country validity and report ownership. |
|
|
39
|
+
| `cbam2_source_flow_manage` | Write | **Contract**: save/delete payloads, enum codes, numeric ranges, unique ids, delete confirmation. | **State**: owning process and calculation rules. |
|
|
40
|
+
| `cbam2_heat_power_update` | Write | **Covered**: positive/non-negative complete input form; calculated outputs absent. | **State**: report include flag and backend calculation. |
|
|
41
|
+
| `cbam2_product_data_update` | Write | **Contract**: process/precursor discriminator, matching item form, exact ids, numeric ranges. | **State**: activity balance, route references, server-derived calculations. |
|
|
42
|
+
| `cbam2_sale_product_manage` | Write | **Contract**: save/delete payloads, form fields, exact ids, calculated/attachment fields absent, delete confirmation. | **State**: process/category/CN references and dependent tax rows. |
|
|
43
|
+
| `cbam2_carbon_tax_manage` | Write | **Contract**: save/delete/calculate payloads, exact ids/codes, delete/calculate confirmation. | **State**: candidates, currencies, running calculation task, backend formula. |
|
|
44
|
+
| `cbam2_data_quality_update` | Write | **Covered**: complete Agent-safe quality fields; ownership/calculated fields absent. | **State/Workflow**: read-before-full-update and report ownership. |
|
|
45
|
+
| `cbam2_report_generate` | Write | **Contract**: exact report id, idempotency, confirmed retry requires pending action id, 120-second timeout, no automatic retry. | **Workflow/State**: WAIT_CONFIRM, asynchronous generation, readiness and download record. |
|
|
46
|
+
| `cbam2_report_generation_status` | Read | **Covered**: exact report and generation ids. | **State**: task belongs to report and current company. |
|
|
31
47
|
| `user_memory_recall` | Read | **Covered**: identity, query length, type filter, limit. | **State**: message/session ownership. |
|
|
32
48
|
| `user_memory_get` | Read | **Covered**: exact `memoryId`. | **State**: memory ownership and visibility. |
|
|
33
49
|
| `user_memory_upsert` | Write | **Covered**: scope/type/source/recall enums, key pattern, content length, confidence ranges. Compatibility permits omitted/zero version. | **Workflow/State**: recall-first workflow, semantic duplicate detection, optimistic-lock state. |
|
|
@@ -38,16 +54,16 @@ Some optional fields retain MCP-side blank/null-to-omitted normalization for com
|
|
|
38
54
|
| `project_memory_forget` | Write | **Covered**: exact id, version, `confirmed=true`. | **State**: project-owner-only delete. |
|
|
39
55
|
| `project_overview` | Read | **Covered**: session identity and optional trace fields; no public project/tenant selector. | **State**: project membership derived from session; bounded result is not a complete index. |
|
|
40
56
|
| `project_member_list` | Read | **Covered**: only `sessionId`; no project, tenant, user, or member selector. | **Workflow/State**: active membership and safe member projection are derived by the backend; enterprise task assignment uses only returned members marked assignable. |
|
|
41
|
-
| `project_task_search` | Read | **Covered**: keyword length; product and enterprise status families; enterprise `fill/approve/all` view; product boolean filters; page and limit bounds. | **Workflow/State**: project type comes from the session; callers must not mix product and enterprise filters. `all` is project-wide only when explicitly requested and is restricted to Owner/Admin; omission defaults to `fill`. Product fallback candidates require semantic comparison and user confirmation when ambiguous. |
|
|
42
|
-
| `project_task_read` | Read | **Covered**: exact project task id, accepting number or numeric string. | **State**: task belongs to the session project; response variant is identified by `businessType` and `
|
|
57
|
+
| `project_task_search` | Read | **Covered**: keyword length; product and enterprise status families; enterprise `fill/approve/all` view and optional task type; product boolean filters; page and limit bounds. | **Workflow/State**: project type comes from the session; callers must not mix product and enterprise filters. `all` is project-wide only when explicitly requested and is restricted to Owner/Admin; omission defaults to `fill`. Product fallback candidates require semantic comparison and user confirmation when ambiguous. |
|
|
58
|
+
| `project_task_read` | Read | **Covered**: exact project task id, accepting number or numeric string. | **State**: task belongs to the session project; response variant is identified by `businessType`, `taskKind`, and enterprise `taskType`. |
|
|
43
59
|
| `project_session_search` | Read | **Covered**: keyword length and limit bound. | **State**: project membership and shared-session visibility. |
|
|
44
60
|
| `project_session_read` | Read | **Covered**: trusted session id and turn limit. | **State**: target belongs to the same project; only visible turns are returned. |
|
|
45
61
|
| `project_calculation_search` | Read | **Covered**: keyword length, page and limit bounds; no `accountId`. | **Workflow/State**: lightweight name/product/unit matching with safe fallback candidates. |
|
|
46
62
|
| `project_calculation_read` | Read | **Covered**: exact `projectCalculationId`; schema explicitly excludes `accountId`. | **State**: active project calculation relation and current membership. |
|
|
47
63
|
| `project_emission_source_read` | Read | **Covered**: exact project relation and emission-source ids; schema explicitly excludes `accountId` and tenant selectors. | **State**: active project membership plus server-restored calculation ownership and emission parent-child validation. |
|
|
48
|
-
| `project_enterprise_source_search` | Read | **Covered**: optional trusted computation/category ids, Scope 1/2/3 enum, emission-source-name keyword length, and pagination; no project/company/year selectors. | **Workflow/State**: enterprise-project-only session, server-locked owner/year, source-name-only keyword matching, and user selection when results are ambiguous. |
|
|
49
|
-
| `project_enterprise_source_read` | Read | **Covered**: exact enterprise `emissionSourceId`; no tenant or accounting-year selectors. | **State**: source belongs to the current enterprise project's server-locked owner/year. |
|
|
50
|
-
| `project_enterprise_task_create` | Write | **Covered**: `confirmed=true`, idempotency key, 1-50 items, exact source/member ids, deadline format, title/description limits; tenant/source-session selectors are absent and automatic retry is disabled. | **Workflow/State**: manager role, explicit confirmation, trusted active assignee member id
|
|
64
|
+
| `project_enterprise_source_search` | Read | **Covered**: optional trusted computation/category ids, Scope 1/2/3 enum, emission-source-name keyword length, and pagination; no project/company/year selectors. | **Workflow/State**: enterprise-project-only session, server-locked owner/year, per-task-type availability, source-name-only keyword matching, and user selection when results are ambiguous. |
|
|
65
|
+
| `project_enterprise_source_read` | Read | **Covered**: exact enterprise `emissionSourceId`; no tenant or accounting-year selectors. | **State**: source belongs to the current enterprise project's server-locked owner/year and returns task availability. |
|
|
66
|
+
| `project_enterprise_task_create` | Write | **Covered**: `confirmed=true`, idempotency key, 1-50 items, exact source/member ids, deadline format, title/description limits; tenant/task-type/source-session selectors are absent and automatic retry is disabled. | **Workflow/State**: manager role, explicit confirmation, trusted active assignee member id (including self-assignment), no duplicate unfinished activity-data task, and transactional backend creation. |
|
|
51
67
|
| `modeling_re_modeling` | Write | **Covered**: account id and idempotency key. | **State**: account ownership/existence. |
|
|
52
68
|
| `modeling_detail` | Read | **Covered**: account id. | **State**: account ownership/existence. |
|
|
53
69
|
| `modeling_account_detail` | Read | **Covered**: account id. | **State**: account ownership/existence. |
|
|
@@ -137,6 +153,11 @@ Stable local codes:
|
|
|
137
153
|
- `DUPLICATE_CLIENT_SOURCE_KEY`
|
|
138
154
|
- `SERVER_GENERATED_FIELD_NOT_ALLOWED`
|
|
139
155
|
- `SERVER_DERIVED_FIELD_NOT_ALLOWED`
|
|
156
|
+
- `REPORT_ID_REQUIRED`, `SECTION_REQUIRED`, `ITEM_TYPE_REQUIRED`, `ITEM_ID_REQUIRED`
|
|
157
|
+
- `ID_REQUIRED`, `ID_NOT_ALLOWED`, `INVALID_ACTION`
|
|
158
|
+
- `UNEXPECTED_IDS`, `UNEXPECTED_ITEMS`, `UNEXPECTED_PAYLOAD`
|
|
159
|
+
- `PENDING_ACTION_ID_REQUIRED`, `INVALID_DATE`, `INVALID_PERIOD`
|
|
160
|
+
- `NON_EMPTY_ARRAY_REQUIRED`, `DUPLICATE_VALUE`, `PRODUCT_DATA_TYPE_MISMATCH`
|
|
140
161
|
- `TOOL_INPUT_SCHEMA_VIOLATION`
|
|
141
162
|
|
|
142
163
|
Ordinary Zod field/type failures are MCP protocol `-32602` errors and are also not dispatched. Backend HTTP/business errors retain the existing normalized backend error format.
|
|
@@ -146,7 +167,7 @@ Ordinary Zod field/type failures are MCP protocol `-32602` errors and are also n
|
|
|
146
167
|
`npm run test:schema` verifies:
|
|
147
168
|
|
|
148
169
|
1. A real in-memory MCP `initialize` and `tools/list` flow.
|
|
149
|
-
2. Exactly
|
|
170
|
+
2. Exactly 71 exposed tools in the current working tree, including 16 CBAM2 task tools covering 31 Java endpoints.
|
|
150
171
|
3. Draft-07 metadata validity, object roots, declared required properties, and resolvable local refs.
|
|
151
172
|
4. One generated minimum-valid public-Schema fixture per tool.
|
|
152
173
|
5. Save/update valid and invalid factor-mode matrices.
|