@carbonstopper/agent-mcp 0.1.46 → 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 +45 -4
- package/dist/apipath.d.ts +31 -0
- package/dist/apipath.js +33 -0
- package/dist/apipath.js.map +1 -1
- package/dist/logger.js +28 -5
- 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 +875 -5
- package/dist/tools.js.map +1 -1
- package/docs/cbam2-agent-integration-guide.md +937 -0
- package/docs/schema-audit.md +26 -5
- 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,9 +9,9 @@ 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.46 |
|
|
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
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
|
|
|
@@ -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. |
|
|
@@ -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.
|