@mcp-abap-adt/core 6.4.0 → 6.4.1

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.
@@ -1,204 +0,0 @@
1
- # High-Level Check Tools for ABAP Objects
2
-
3
- **Issue:** #54 — Add Check tools for ABAP objects (syntax/semantic validation)
4
- **Date:** 2026-04-13
5
-
6
- ## Problem
7
-
8
- LLM agents create/update ABAP objects but errors are only discovered at activation time. This causes expensive retry loops. Low-level Check handlers exist but are not exposed as standalone high-level tools — check is only embedded inside Create/Update workflows.
9
-
10
- ## Solution
11
-
12
- Add 13 high-level Check tools — one per object type that has a low-level check handler. Each is an adapter wrapper that delegates to the existing low-level handler and normalizes the response: strips session fields, adds a shared `object_name` field, and returns a consistent core response shape.
13
-
14
- ## Non-goals / Limitations
15
-
16
- - Check tools do **not** perform lock/update/activate flows — they only run syntax/semantic validation.
17
- - Hypothetical source checking is only supported where the low-level handler already supports it (`source_code`, `ddl_code`, or `ddl_source`).
18
- - No automatic `super_package` resolution in Phase 1 — callers must provide it for `CheckPackage`.
19
-
20
- ## Tools
21
-
22
- | High-level tool name | Low-level handler | source param | version default | available_in |
23
- |---|---|---|---|---|
24
- | `CheckBehaviorDefinition` | `handleCheckBehaviorDefinition` | — | — | onprem, cloud |
25
- | `CheckClass` | `handleCheckClass` | `source_code` | active | onprem, cloud, legacy |
26
- | `CheckDataElement` | `handleCheckDataElement` | — | — | onprem, cloud |
27
- | `CheckDomain` | `handleCheckDomain` | — | — | onprem, cloud |
28
- | `CheckFunctionGroup` | `handleCheckFunctionGroup` | — | — | onprem, cloud, legacy |
29
- | `CheckFunctionModule` | `handleCheckFunctionModule` | — | active | onprem, cloud, legacy |
30
- | `CheckInterface` | `handleCheckInterface` | — | — | onprem, cloud, legacy |
31
- | `CheckMetadataExtension` | `handleCheckMetadataExtension` | — | — | onprem, cloud |
32
- | `CheckPackage` | `handleCheckPackage` | — | — | onprem, cloud, legacy |
33
- | `CheckProgram` | `handleCheckProgram` | — | — | onprem, legacy |
34
- | `CheckStructure` | `handleCheckStructure` | `ddl_code` | inactive | onprem, cloud |
35
- | `CheckTable` | `handleCheckTable` | `ddl_code` | new | onprem, cloud |
36
- | `CheckView` | `handleCheckView` | `ddl_source` | inactive | onprem, cloud, legacy |
37
-
38
- ## Handler pattern
39
-
40
- Each high-level Check handler:
41
-
42
- 1. Exports a `TOOL_DEFINITION` with high-level name (no `Low` suffix)
43
- 2. Same `available_in` as the low-level counterpart
44
- 3. Input schema **excludes** `session_id` and `session_state`
45
- 4. Passes through source param where supported by low-level
46
- 5. Passes through `version` where supported by low-level
47
- 6. Delegates to the existing low-level handler function
48
- 7. Normalizes response: strips `session_id`/`session_state` from output, adds shared `object_name` field
49
- 8. If low-level handler returns `isError: true` or a non-JSON payload, returns it unchanged without attempting normalization
50
-
51
- ### File location
52
-
53
- Each handler in its object type's `high/` directory:
54
-
55
- ```
56
- src/handlers/behavior_definition/high/handleCheckBehaviorDefinition.ts
57
- src/handlers/class/high/handleCheckClass.ts
58
- src/handlers/data_element/high/handleCheckDataElement.ts
59
- src/handlers/ddlx/high/handleCheckMetadataExtension.ts
60
- src/handlers/domain/high/handleCheckDomain.ts
61
- src/handlers/function/high/handleCheckFunctionGroup.ts
62
- src/handlers/function/high/handleCheckFunctionModule.ts
63
- src/handlers/interface/high/handleCheckInterface.ts
64
- src/handlers/package/high/handleCheckPackage.ts
65
- src/handlers/program/high/handleCheckProgram.ts
66
- src/handlers/structure/high/handleCheckStructure.ts
67
- src/handlers/table/high/handleCheckTable.ts
68
- src/handlers/view/high/handleCheckView.ts
69
- ```
70
-
71
- Note: both FunctionGroup and FunctionModule handlers live in `src/handlers/function/high/` — same directory structure as low-level handlers.
72
-
73
- ## Normalized response shape
74
-
75
- All high-level Check tools return a JSON response with the following normalized common fields (object-specific compatibility fields like `class_name`, `view_name`, `name` are preserved alongside):
76
-
77
- ```typescript
78
- {
79
- success: boolean; // true if no errors
80
- object_name: string; // canonical shared field (uppercased)
81
- check_result: { // from parseCheckRunResponse()
82
- success: boolean;
83
- status: string;
84
- message: string;
85
- errors: Array<{ type: string; text: string; line?: string | number; href?: string }>;
86
- warnings: Array<{ type: string; text: string; line?: string | number; href?: string }>;
87
- info: Array<{ type: string; text: string; line?: string | number; href?: string }>;
88
- total_messages: number;
89
- has_errors: boolean;
90
- has_warnings: boolean;
91
- };
92
- message: string; // human-readable summary
93
- // object-specific field preserved for compatibility:
94
- class_name?: string; // CheckClass
95
- view_name?: string; // CheckView
96
- package_name?: string; // CheckPackage
97
- // etc.
98
- }
99
- ```
100
-
101
- **Excluded from output:** `session_id`, `session_state`.
102
-
103
- **Error path:** If the low-level handler returns `isError: true` or a non-JSON payload, the high-level wrapper returns that error unchanged — no normalization applied.
104
-
105
- **Field naming for objects using `name`:** BehaviorDefinition and MetadataExtension use `name` as their low-level input field. In the response, keep `name` for compatibility but always add `object_name` as the canonical shared field.
106
-
107
- ## Special parameters per object type
108
-
109
- - **CheckFunctionModule**: requires `function_group_name` + `function_module_name`
110
- - **CheckPackage**: requires `package_name` + `super_package`
111
- - **CheckTable**: `reporter` removed from high-level API (low-level default `abapCheckRun` is used)
112
-
113
- ## Example: CheckClass
114
-
115
- ```typescript
116
- import { handleCheckClass as handleCheckClassLow } from '../low/handleCheckClass';
117
- import type { HandlerContext } from '../../../lib/handlers/interfaces';
118
- import { return_response } from '../../../lib/utils';
119
-
120
- export const TOOL_DEFINITION = {
121
- name: 'CheckClass',
122
- available_in: ['onprem', 'cloud', 'legacy'] as const,
123
- description: 'Perform syntax check on an ABAP class. Can check existing class (active/inactive) or validate hypothetical source code. Returns syntax errors, warnings, and messages.',
124
- inputSchema: {
125
- type: 'object',
126
- properties: {
127
- class_name: { type: 'string', description: 'Name of the ABAP class to check' },
128
- version: { type: 'string', enum: ['active', 'inactive'], description: 'Version to check. Default: active' },
129
- source_code: { type: 'string', description: 'Optional source code to check instead of the saved version' },
130
- },
131
- required: ['class_name'],
132
- },
133
- } as const;
134
-
135
- export async function handleCheckClass(context: HandlerContext, args: Record<string, unknown>) {
136
- const result = await handleCheckClassLow(context, args);
137
- // Normalize: parse low-level JSON, add object_name, strip session fields
138
- const data = JSON.parse(result.content[0].text);
139
- delete data.session_id;
140
- delete data.session_state;
141
- data.object_name = data.class_name;
142
- return return_response({ data: JSON.stringify(data, null, 2) });
143
- }
144
- ```
145
-
146
- ## Example: CheckBehaviorDefinition (no source param, no version)
147
-
148
- ```typescript
149
- import { handleCheckBehaviorDefinition as handleCheckBdefLow } from '../low/handleCheckBehaviorDefinition';
150
- import type { HandlerContext } from '../../../lib/handlers/interfaces';
151
- import { return_response } from '../../../lib/utils';
152
-
153
- export const TOOL_DEFINITION = {
154
- name: 'CheckBehaviorDefinition',
155
- available_in: ['onprem', 'cloud'] as const,
156
- description: 'Perform syntax check on an ABAP behavior definition (BDEF). Returns syntax errors, warnings, and messages.',
157
- inputSchema: {
158
- type: 'object',
159
- properties: {
160
- name: { type: 'string', description: 'Name of the behavior definition to check' },
161
- },
162
- required: ['name'],
163
- },
164
- } as const;
165
-
166
- export async function handleCheckBehaviorDefinition(context: HandlerContext, args: Record<string, unknown>) {
167
- const result = await handleCheckBdefLow(context, args);
168
- const data = JSON.parse(result.content[0].text);
169
- delete data.session_id;
170
- delete data.session_state;
171
- data.object_name = data.name;
172
- return return_response({ data: JSON.stringify(data, null, 2) });
173
- }
174
- ```
175
-
176
- ## Registration
177
-
178
- All 13 handlers registered in `src/lib/handlers/groups/HighLevelHandlersGroup.ts` following existing pattern.
179
-
180
- ## Acceptance criteria
181
-
182
- - [ ] High-level input schemas exclude `session_id` and `session_state`
183
- - [ ] High-level responses do not contain `session_id` or `session_state`
184
- - [ ] Response includes normalized `object_name` field
185
- - [ ] Response includes `success`, `message`, and `check_result` fields
186
- - [ ] Each tool is registered in `HighLevelHandlersGroup.ts`
187
- - [ ] Environment gating follows `available_in` from corresponding low-level handler
188
- - [ ] `CheckTable` does not expose `reporter` parameter
189
- - [ ] Each tool has integration test coverage in `src/__tests__/integration/high/` layout
190
-
191
- ## Testing
192
-
193
- Integration tests for each Check tool in `src/__tests__/integration/high/` directories, following existing test patterns. Tests must verify:
194
-
195
- - Tool registration and availability per environment
196
- - Normalized response contract: `object_name` present, `session_id`/`session_state` absent
197
- - Preservation of object-specific fields (e.g., `class_name`, `view_name`)
198
- - `success`, `message`, `check_result` fields present in response
199
-
200
- ## Phased delivery
201
-
202
- **Phase 1** (this PR): Adapter wrappers with response normalization, registration in HighLevelHandlersGroup, integration tests verifying normalized contract.
203
-
204
- **Phase 2** (future): API ergonomics — optional `super_package` resolution in CheckPackage, richer error descriptions for LLM agents.