@linkup-ai/abap-ai 2.0.0
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/README.md +384 -0
- package/dist/adt-client.js +364 -0
- package/dist/cli/activate.js +113 -0
- package/dist/cli/init.js +333 -0
- package/dist/cli/remove.js +80 -0
- package/dist/cli/status.js +229 -0
- package/dist/cli/systems.js +68 -0
- package/dist/cli.js +81 -0
- package/dist/index.js +1318 -0
- package/dist/knowledge/abap/abap-dictionary.md +199 -0
- package/dist/knowledge/abap/abap-sql.md +296 -0
- package/dist/knowledge/abap/amdp.md +273 -0
- package/dist/knowledge/abap/clean-code.md +293 -0
- package/dist/knowledge/abap/cloud-background-processing.md +250 -0
- package/dist/knowledge/abap/cloud-communication.md +265 -0
- package/dist/knowledge/abap/cloud-development.md +176 -0
- package/dist/knowledge/abap/cloud-extensibility.md +252 -0
- package/dist/knowledge/abap/cloud-released-apis.md +261 -0
- package/dist/knowledge/abap/constructor-expressions.md +289 -0
- package/dist/knowledge/abap/enhancements.md +232 -0
- package/dist/knowledge/abap/exceptions.md +271 -0
- package/dist/knowledge/abap/internal-tables.md +205 -0
- package/dist/knowledge/abap/object-orientation.md +298 -0
- package/dist/knowledge/abap/performance.md +216 -0
- package/dist/knowledge/abap/rap-abstract-entities.md +206 -0
- package/dist/knowledge/abap/rap-business-events.md +216 -0
- package/dist/knowledge/abap/rap-draft.md +191 -0
- package/dist/knowledge/abap/rap-eml.md +453 -0
- package/dist/knowledge/abap/rap-end-to-end.md +486 -0
- package/dist/knowledge/abap/rap-feature-control.md +185 -0
- package/dist/knowledge/abap/rap-numbering.md +280 -0
- package/dist/knowledge/abap/rap-service-exposure.md +163 -0
- package/dist/knowledge/abap/rap-unmanaged.md +468 -0
- package/dist/knowledge/abap/string-processing.md +180 -0
- package/dist/knowledge/abap/unit-testing.md +303 -0
- package/dist/knowledge/abap-cds/access-control.md +241 -0
- package/dist/knowledge/abap-cds/annotations.md +331 -0
- package/dist/knowledge/abap-cds/associations.md +254 -0
- package/dist/knowledge/abap-cds/expressions.md +230 -0
- package/dist/knowledge/abap-cds/functions.md +245 -0
- package/dist/knowledge/abap-cds/metadata-extensions.md +294 -0
- package/dist/knowledge/cap/authentication.md +278 -0
- package/dist/knowledge/cap/cdl-syntax.md +247 -0
- package/dist/knowledge/cap/cql-queries.md +266 -0
- package/dist/knowledge/cap/deployment.md +343 -0
- package/dist/knowledge/cap/event-handlers.md +287 -0
- package/dist/knowledge/cap/fiori-integration.md +303 -0
- package/dist/knowledge/cap/service-definitions.md +287 -0
- package/dist/knowledge/fiori/annotations.md +347 -0
- package/dist/knowledge/fiori/deployment.md +340 -0
- package/dist/knowledge/fiori/fiori-elements.md +332 -0
- package/dist/knowledge/fiori/fiori-side-effects.md +107 -0
- package/dist/knowledge/fiori/fiori-valuelist.md +144 -0
- package/dist/knowledge/fiori/ui5-controllers.md +358 -0
- package/dist/knowledge/fiori/ui5-data-binding.md +311 -0
- package/dist/knowledge/fiori/ui5-fragments-dialogs.md +330 -0
- package/dist/knowledge/fiori/ui5-manifest.md +411 -0
- package/dist/knowledge/fiori/ui5-routing.md +303 -0
- package/dist/knowledge/fiori/ui5-xml-views.md +294 -0
- package/dist/logger.js +114 -0
- package/dist/system-profile.js +207 -0
- package/dist/tools/abap-doc.js +72 -0
- package/dist/tools/abapgit.js +161 -0
- package/dist/tools/activate.js +68 -0
- package/dist/tools/atc-check.js +117 -0
- package/dist/tools/auth-object.js +56 -0
- package/dist/tools/breakpoints.js +76 -0
- package/dist/tools/call-hierarchy.js +84 -0
- package/dist/tools/cds-annotations.js +98 -0
- package/dist/tools/cds-dependencies.js +65 -0
- package/dist/tools/check.js +47 -0
- package/dist/tools/code-completion.js +70 -0
- package/dist/tools/code-coverage.js +111 -0
- package/dist/tools/create-amdp.js +111 -0
- package/dist/tools/create-dcl.js +81 -0
- package/dist/tools/create-transport.js +38 -0
- package/dist/tools/create.js +285 -0
- package/dist/tools/data-preview.js +37 -0
- package/dist/tools/delete.js +45 -0
- package/dist/tools/deploy-bsp.js +298 -0
- package/dist/tools/discovery.js +59 -0
- package/dist/tools/element-info.js +93 -0
- package/dist/tools/enhancements.js +186 -0
- package/dist/tools/extract-method.js +44 -0
- package/dist/tools/function-group.js +59 -0
- package/dist/tools/knowledge.js +275 -0
- package/dist/tools/lock-object.js +75 -0
- package/dist/tools/message-class.js +67 -0
- package/dist/tools/navigate.js +80 -0
- package/dist/tools/number-range.js +57 -0
- package/dist/tools/object-documentation.js +43 -0
- package/dist/tools/object-structure.js +78 -0
- package/dist/tools/object-versions.js +57 -0
- package/dist/tools/package-contents.js +60 -0
- package/dist/tools/pretty-printer.js +35 -0
- package/dist/tools/publish-binding.js +49 -0
- package/dist/tools/quick-fix.js +69 -0
- package/dist/tools/read.js +167 -0
- package/dist/tools/refactor-rename.js +60 -0
- package/dist/tools/release-transport.js +24 -0
- package/dist/tools/released-apis.js +51 -0
- package/dist/tools/repository-tree.js +90 -0
- package/dist/tools/scaffold-rap.js +642 -0
- package/dist/tools/search.js +73 -0
- package/dist/tools/shared/data-format.js +101 -0
- package/dist/tools/sql-console.js +17 -0
- package/dist/tools/system-info.js +270 -0
- package/dist/tools/traces.js +66 -0
- package/dist/tools/transport-contents.js +83 -0
- package/dist/tools/transports.js +67 -0
- package/dist/tools/unit-test.js +135 -0
- package/dist/tools/where-used.js +59 -0
- package/dist/tools/write.js +101 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1318 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
4
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const read_js_1 = require("./tools/read.js");
|
|
7
|
+
const write_js_1 = require("./tools/write.js");
|
|
8
|
+
const activate_js_1 = require("./tools/activate.js");
|
|
9
|
+
const search_js_1 = require("./tools/search.js");
|
|
10
|
+
const create_js_1 = require("./tools/create.js");
|
|
11
|
+
const where_used_js_1 = require("./tools/where-used.js");
|
|
12
|
+
const check_js_1 = require("./tools/check.js");
|
|
13
|
+
const transports_js_1 = require("./tools/transports.js");
|
|
14
|
+
const scaffold_rap_js_1 = require("./tools/scaffold-rap.js");
|
|
15
|
+
const publish_binding_js_1 = require("./tools/publish-binding.js");
|
|
16
|
+
const deploy_bsp_js_1 = require("./tools/deploy-bsp.js");
|
|
17
|
+
const system_info_js_1 = require("./tools/system-info.js");
|
|
18
|
+
const object_structure_js_1 = require("./tools/object-structure.js");
|
|
19
|
+
const data_preview_js_1 = require("./tools/data-preview.js");
|
|
20
|
+
const element_info_js_1 = require("./tools/element-info.js");
|
|
21
|
+
const pretty_printer_js_1 = require("./tools/pretty-printer.js");
|
|
22
|
+
const unit_test_js_1 = require("./tools/unit-test.js");
|
|
23
|
+
const atc_check_js_1 = require("./tools/atc-check.js");
|
|
24
|
+
const package_contents_js_1 = require("./tools/package-contents.js");
|
|
25
|
+
const object_versions_js_1 = require("./tools/object-versions.js");
|
|
26
|
+
const function_group_js_1 = require("./tools/function-group.js");
|
|
27
|
+
const message_class_js_1 = require("./tools/message-class.js");
|
|
28
|
+
const abap_doc_js_1 = require("./tools/abap-doc.js");
|
|
29
|
+
const release_transport_js_1 = require("./tools/release-transport.js");
|
|
30
|
+
const delete_js_1 = require("./tools/delete.js");
|
|
31
|
+
const refactor_rename_js_1 = require("./tools/refactor-rename.js");
|
|
32
|
+
const code_completion_js_1 = require("./tools/code-completion.js");
|
|
33
|
+
const navigate_js_1 = require("./tools/navigate.js");
|
|
34
|
+
const call_hierarchy_js_1 = require("./tools/call-hierarchy.js");
|
|
35
|
+
const quick_fix_js_1 = require("./tools/quick-fix.js");
|
|
36
|
+
const extract_method_js_1 = require("./tools/extract-method.js");
|
|
37
|
+
const code_coverage_js_1 = require("./tools/code-coverage.js");
|
|
38
|
+
const sql_console_js_1 = require("./tools/sql-console.js");
|
|
39
|
+
const transport_contents_js_1 = require("./tools/transport-contents.js");
|
|
40
|
+
const create_transport_js_1 = require("./tools/create-transport.js");
|
|
41
|
+
const cds_annotations_js_1 = require("./tools/cds-annotations.js");
|
|
42
|
+
const cds_dependencies_js_1 = require("./tools/cds-dependencies.js");
|
|
43
|
+
const enhancements_js_1 = require("./tools/enhancements.js");
|
|
44
|
+
const lock_object_js_1 = require("./tools/lock-object.js");
|
|
45
|
+
const auth_object_js_1 = require("./tools/auth-object.js");
|
|
46
|
+
const number_range_js_1 = require("./tools/number-range.js");
|
|
47
|
+
const repository_tree_js_1 = require("./tools/repository-tree.js");
|
|
48
|
+
const discovery_js_1 = require("./tools/discovery.js");
|
|
49
|
+
const released_apis_js_1 = require("./tools/released-apis.js");
|
|
50
|
+
const object_documentation_js_1 = require("./tools/object-documentation.js");
|
|
51
|
+
const abapgit_js_1 = require("./tools/abapgit.js");
|
|
52
|
+
const traces_js_1 = require("./tools/traces.js");
|
|
53
|
+
const breakpoints_js_1 = require("./tools/breakpoints.js");
|
|
54
|
+
const knowledge_js_1 = require("./tools/knowledge.js");
|
|
55
|
+
const create_dcl_js_1 = require("./tools/create-dcl.js");
|
|
56
|
+
const create_amdp_js_1 = require("./tools/create-amdp.js");
|
|
57
|
+
const system_profile_js_1 = require("./system-profile.js");
|
|
58
|
+
const server = new mcp_js_1.McpServer({
|
|
59
|
+
name: "abap-adt",
|
|
60
|
+
version: "2.0.0",
|
|
61
|
+
});
|
|
62
|
+
// Tool: abap_read
|
|
63
|
+
server.tool("abap_read", "Lê o código-fonte de um objeto ABAP no sistema SAP via ADT API. Para tabelas (TABL/DT), estruturas (TABL/DS) e table types (TTYP/TT), retorna a lista de campos com tipo e descrição.", {
|
|
64
|
+
object_type: zod_1.z
|
|
65
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
66
|
+
.describe("Tipo do objeto SAP. Ex: PROG/P (report), CLAS/OC (classe), DDLS/DF (CDS view), TABL/DT (tabela), TABL/DS (estrutura), TTYP/TT (table type)."),
|
|
67
|
+
object_name: zod_1.z
|
|
68
|
+
.string()
|
|
69
|
+
.describe("Nome do objeto ABAP (ex: ZR_SD_PEDIDOS_ABERTOS)."),
|
|
70
|
+
class_include: zod_1.z
|
|
71
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Include da classe a ler. Apenas para CLAS/OC. Padrão: main (definição da classe)."),
|
|
74
|
+
}, async ({ object_type, object_name, class_include }) => {
|
|
75
|
+
try {
|
|
76
|
+
const source = await (0, read_js_1.abapRead)({ object_type, object_name, class_include });
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: source }],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
83
|
+
return {
|
|
84
|
+
content: [{ type: "text", text: `Erro ao ler objeto: ${message}` }],
|
|
85
|
+
isError: true,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// Tool: abap_write
|
|
90
|
+
server.tool("abap_write", "Grava código-fonte em um objeto ABAP existente no sistema SAP via ADT API. DICA: antes de escrever código, consulte abap_knowledge(action:'search', query:'assunto') para padrões e exemplos de referência. IMPORTANTE: para objetos existentes, use abap_object_versions ANTES de modificar para verificar se há versões não transportadas ou modificações recentes de outros desenvolvedores.", {
|
|
91
|
+
object_type: zod_1.z
|
|
92
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
93
|
+
.describe("Tipo do objeto SAP. Ex: PROG/P (report), CLAS/OC (classe), DDLS/DF (CDS view)."),
|
|
94
|
+
object_name: zod_1.z
|
|
95
|
+
.string()
|
|
96
|
+
.describe("Nome do objeto ABAP (ex: ZTESTEDENIS)."),
|
|
97
|
+
source: zod_1.z
|
|
98
|
+
.string()
|
|
99
|
+
.describe("Código-fonte ABAP completo para gravar no objeto."),
|
|
100
|
+
class_include: zod_1.z
|
|
101
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
102
|
+
.optional()
|
|
103
|
+
.describe("Include da classe a gravar. Apenas para CLAS/OC. Padrão: main (definição da classe)."),
|
|
104
|
+
transport_request: zod_1.z
|
|
105
|
+
.string()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe("Ordem de transporte (ex: ECDK900123). Obrigatória para objetos em pacotes não-locais."),
|
|
108
|
+
}, async ({ object_type, object_name, source, class_include, transport_request }) => {
|
|
109
|
+
try {
|
|
110
|
+
const result = await (0, write_js_1.abapWrite)({ object_type, object_name, source, class_include, transport_request });
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: "text", text: result }],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
117
|
+
return {
|
|
118
|
+
content: [{ type: "text", text: `Erro ao gravar objeto: ${message}` }],
|
|
119
|
+
isError: true,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
// Tool: abap_activate
|
|
124
|
+
server.tool("abap_activate", "Ativa um objeto ABAP no sistema SAP via ADT API. Retorna erros de sintaxe se a ativação falhar.", {
|
|
125
|
+
object_type: zod_1.z
|
|
126
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
127
|
+
.describe("Tipo do objeto SAP. Ex: PROG/P (report), CLAS/OC (classe)."),
|
|
128
|
+
object_name: zod_1.z
|
|
129
|
+
.string()
|
|
130
|
+
.describe("Nome do objeto ABAP (ex: ZTESTEDENIS)."),
|
|
131
|
+
}, async ({ object_type, object_name }) => {
|
|
132
|
+
try {
|
|
133
|
+
const result = await (0, activate_js_1.abapActivate)({ object_type, object_name });
|
|
134
|
+
return {
|
|
135
|
+
content: [{ type: "text", text: result }],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
140
|
+
return {
|
|
141
|
+
content: [{ type: "text", text: `Erro ao ativar objeto: ${message}` }],
|
|
142
|
+
isError: true,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
// Tool: abap_create
|
|
147
|
+
server.tool("abap_create", "Cria um novo objeto ABAP no sistema SAP via ADT API. Suporta programas, classes, interfaces, objetos DDIC (domínio, data element, tabela, estrutura, table type, message class, function group) e objetos RAP/Fiori. " +
|
|
148
|
+
"DICA: antes de criar objetos RAP/CDS/Fiori, consulte abap_knowledge(action:'search', query:'tipo do objeto') para boas práticas. " +
|
|
149
|
+
"IMPORTANTE: antes de criar qualquer objeto, use abap_search para verificar se já existe um com o mesmo nome. Para extensões (BAdIs, enhancements), consulte abap_knowledge(action:'get', topics:['abap/enhancements']) — extensões single-use só permitem UMA implementação.", {
|
|
150
|
+
object_type: zod_1.z
|
|
151
|
+
.enum(["PROG/P", "CLAS/OC", "INTF/OI", "FUGR/F", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "MSAG/N", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
152
|
+
.describe("Tipo do objeto SAP a criar. Ex: PROG/P (report), CLAS/OC (classe), TABL/DT (tabela transparente), MSAG/N (message class), DDLS/DF (CDS view)."),
|
|
153
|
+
object_name: zod_1.z
|
|
154
|
+
.string()
|
|
155
|
+
.describe("Nome do novo objeto ABAP (ex: ZR_SD_PEDIDOS)."),
|
|
156
|
+
description: zod_1.z
|
|
157
|
+
.string()
|
|
158
|
+
.describe("Descrição curta do objeto (aparece no SAP GUI)."),
|
|
159
|
+
package: zod_1.z
|
|
160
|
+
.string()
|
|
161
|
+
.optional()
|
|
162
|
+
.describe("Pacote SAP. Use '$TMP' para local (padrão) ou 'ZDEV' para desenvolvimento."),
|
|
163
|
+
srvd_name: zod_1.z
|
|
164
|
+
.string()
|
|
165
|
+
.optional()
|
|
166
|
+
.describe("Nome da Service Definition (SRVD/SRV) associada. Obrigatório para SRVB/SVB."),
|
|
167
|
+
binding_type: zod_1.z
|
|
168
|
+
.enum(["ODATA;V4;UI", "ODATA;V2;UI", "ODATA;V4;WEB_API"])
|
|
169
|
+
.optional()
|
|
170
|
+
.describe("Protocolo do Service Binding. Padrão: ODATA;V4;UI. Apenas para SRVB/SVB."),
|
|
171
|
+
transport_request: zod_1.z
|
|
172
|
+
.string()
|
|
173
|
+
.optional()
|
|
174
|
+
.describe("Ordem de transporte (ex: ECDK900123). Se omitida, o SAP usa $TMP ou atribui automaticamente."),
|
|
175
|
+
}, async ({ object_type, object_name, description, package: pkg, srvd_name, binding_type, transport_request }) => {
|
|
176
|
+
try {
|
|
177
|
+
const result = await (0, create_js_1.abapCreate)({ object_type, object_name, description, package: pkg, srvd_name, binding_type, transport_request });
|
|
178
|
+
return {
|
|
179
|
+
content: [{ type: "text", text: result }],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
184
|
+
return {
|
|
185
|
+
content: [{ type: "text", text: `Erro ao criar objeto: ${message}` }],
|
|
186
|
+
isError: true,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
// Tool: abap_search
|
|
191
|
+
server.tool("abap_search", "Pesquisa objetos ABAP no sistema SAP por nome (suporta wildcards com *). Retorna nome, tipo e pacote.", {
|
|
192
|
+
query: zod_1.z
|
|
193
|
+
.string()
|
|
194
|
+
.describe("Termo de busca com wildcard opcional (*). Ex: 'ZR_SD_*', 'Z*PEDIDO*'."),
|
|
195
|
+
object_type: zod_1.z
|
|
196
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "FUGR/F", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "MSAG/N", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
197
|
+
.optional()
|
|
198
|
+
.describe("Filtrar por tipo de objeto (opcional). Inclui FUGR/F (grupo de funções), TTYP/TT (table type), MSAG/N (classe de mensagem)."),
|
|
199
|
+
max_results: zod_1.z
|
|
200
|
+
.number()
|
|
201
|
+
.optional()
|
|
202
|
+
.describe("Número máximo de resultados (padrão: 20)."),
|
|
203
|
+
}, async ({ query, object_type, max_results }) => {
|
|
204
|
+
try {
|
|
205
|
+
const result = await (0, search_js_1.abapSearch)({ query, object_type, max_results });
|
|
206
|
+
return {
|
|
207
|
+
content: [{ type: "text", text: result }],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
212
|
+
return {
|
|
213
|
+
content: [{ type: "text", text: `Erro na pesquisa: ${message}` }],
|
|
214
|
+
isError: true,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
// Tool: abap_where_used
|
|
219
|
+
server.tool("abap_where_used", "Retorna onde um objeto ABAP é referenciado no sistema SAP (where-used list).", {
|
|
220
|
+
object_type: zod_1.z
|
|
221
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "FUGR/F", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "MSAG/N", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
222
|
+
.describe("Tipo do objeto SAP. Ex: CLAS/OC (classe), DDLS/DF (CDS view), FUGR/F (grupo de funções)."),
|
|
223
|
+
object_name: zod_1.z
|
|
224
|
+
.string()
|
|
225
|
+
.describe("Nome do objeto ABAP (ex: ZCL_SD_HELPER)."),
|
|
226
|
+
max_results: zod_1.z
|
|
227
|
+
.number()
|
|
228
|
+
.optional()
|
|
229
|
+
.describe("Número máximo de referências retornadas (padrão: 50)."),
|
|
230
|
+
}, async ({ object_type, object_name, max_results }) => {
|
|
231
|
+
try {
|
|
232
|
+
const result = await (0, where_used_js_1.abapWhereUsed)({ object_type, object_name, max_results });
|
|
233
|
+
return {
|
|
234
|
+
content: [{ type: "text", text: result }],
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
239
|
+
return {
|
|
240
|
+
content: [{ type: "text", text: `Erro ao buscar referências: ${message}` }],
|
|
241
|
+
isError: true,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
// Tool: abap_check
|
|
246
|
+
server.tool("abap_check", "Verifica erros de sintaxe de um objeto ABAP sem intenção de ativar. Retorna erros e avisos com número de linha.", {
|
|
247
|
+
object_type: zod_1.z
|
|
248
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
249
|
+
.describe("Tipo do objeto SAP. Ex: PROG/P (report), CLAS/OC (classe)."),
|
|
250
|
+
object_name: zod_1.z
|
|
251
|
+
.string()
|
|
252
|
+
.describe("Nome do objeto ABAP (ex: ZTESTEDENIS)."),
|
|
253
|
+
}, async ({ object_type, object_name }) => {
|
|
254
|
+
try {
|
|
255
|
+
const result = await (0, check_js_1.abapCheck)({ object_type, object_name });
|
|
256
|
+
return {
|
|
257
|
+
content: [{ type: "text", text: result }],
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
262
|
+
return {
|
|
263
|
+
content: [{ type: "text", text: `Erro ao verificar sintaxe: ${message}` }],
|
|
264
|
+
isError: true,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
// Tool: abap_list_transports
|
|
269
|
+
server.tool("abap_list_transports", "Lista ordens de transporte abertas no sistema SAP para um usuário.", {
|
|
270
|
+
user: zod_1.z
|
|
271
|
+
.string()
|
|
272
|
+
.optional()
|
|
273
|
+
.describe("Usuário SAP (padrão: usuário configurado no servidor)."),
|
|
274
|
+
status: zod_1.z
|
|
275
|
+
.string()
|
|
276
|
+
.optional()
|
|
277
|
+
.describe("Status das ordens. Padrão: 'D' (draft/abertas). Use 'R' para liberadas."),
|
|
278
|
+
}, async ({ user, status }) => {
|
|
279
|
+
try {
|
|
280
|
+
const result = await (0, transports_js_1.abapListTransports)({ user, status });
|
|
281
|
+
return {
|
|
282
|
+
content: [{ type: "text", text: result }],
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
287
|
+
return {
|
|
288
|
+
content: [{ type: "text", text: `Erro ao listar ordens: ${message}` }],
|
|
289
|
+
isError: true,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
// Tool: abap_assign_transport
|
|
294
|
+
server.tool("abap_assign_transport", "Vincula um objeto ABAP existente a uma ordem de transporte no sistema SAP.", {
|
|
295
|
+
transport_request: zod_1.z
|
|
296
|
+
.string()
|
|
297
|
+
.describe("Número da ordem de transporte (ex: ECDK900123)."),
|
|
298
|
+
object_type: zod_1.z
|
|
299
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "FUGR/F", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "MSAG/N", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
300
|
+
.describe("Tipo do objeto SAP."),
|
|
301
|
+
object_name: zod_1.z
|
|
302
|
+
.string()
|
|
303
|
+
.describe("Nome do objeto ABAP a vincular."),
|
|
304
|
+
}, async ({ transport_request, object_type, object_name }) => {
|
|
305
|
+
try {
|
|
306
|
+
const result = await (0, transports_js_1.abapAssignTransport)({ transport_request, object_type, object_name });
|
|
307
|
+
return {
|
|
308
|
+
content: [{ type: "text", text: result }],
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
313
|
+
return {
|
|
314
|
+
content: [{ type: "text", text: `Erro ao vincular objeto: ${message}` }],
|
|
315
|
+
isError: true,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
// Tool: abap_scaffold_rap
|
|
320
|
+
server.tool("abap_scaffold_rap", "Cria um stack RAP completo no SAP com 4 scenarios. " +
|
|
321
|
+
"managed: CDS→BDEF→SRVD→SRVB (básico). " +
|
|
322
|
+
"managed_draft: stack completo com draft (CDS root/child→BDEF→handler→projection→SRVD→SRVB→DDLX). " +
|
|
323
|
+
"unmanaged: BDEF unmanaged com handler+saver para wrapping de BAPIs/FMs. " +
|
|
324
|
+
"query: custom entity + classe if_rap_query_provider para read-only. " +
|
|
325
|
+
"DICA: consulte abap_knowledge(action:'search', query:'rap') antes para escolher o scenario correto.", {
|
|
326
|
+
base_name: zod_1.z
|
|
327
|
+
.string()
|
|
328
|
+
.describe("Nome base dos objetos (ex: ZI_ORDER). Prefixo Z já incluído. Para managed_draft/unmanaged use padrão ZI_ (interface)."),
|
|
329
|
+
description: zod_1.z
|
|
330
|
+
.string()
|
|
331
|
+
.describe("Descrição curta dos objetos (usada em todos os objetos do stack)."),
|
|
332
|
+
scenario: zod_1.z
|
|
333
|
+
.enum(["managed", "managed_draft", "unmanaged", "query"])
|
|
334
|
+
.optional()
|
|
335
|
+
.describe("Scenario RAP: 'managed' (básico), 'managed_draft' (completo com draft+projection), 'unmanaged' (BAPI wrapping), 'query' (custom entity read-only). Padrão: managed."),
|
|
336
|
+
child_entities: zod_1.z
|
|
337
|
+
.array(zod_1.z.string())
|
|
338
|
+
.optional()
|
|
339
|
+
.describe("Nomes das entidades filhas para composição (ex: ['ZI_ORDER_ITEM']). Apenas para managed_draft e unmanaged."),
|
|
340
|
+
with_feature_control: zod_1.z
|
|
341
|
+
.boolean()
|
|
342
|
+
.optional()
|
|
343
|
+
.describe("Adicionar feature control (instance) no BDEF e handler. Apenas para managed_draft."),
|
|
344
|
+
with_business_events: zod_1.z
|
|
345
|
+
.array(zod_1.z.string())
|
|
346
|
+
.optional()
|
|
347
|
+
.describe("Nomes de business events a declarar no BDEF (ex: ['OrderCreated', 'OrderStatusChanged']). Apenas para managed_draft."),
|
|
348
|
+
package: zod_1.z
|
|
349
|
+
.string()
|
|
350
|
+
.optional()
|
|
351
|
+
.describe("Pacote SAP. Padrão: '$TMP'."),
|
|
352
|
+
binding_type: zod_1.z
|
|
353
|
+
.enum(["ODATA;V4;UI", "ODATA;V2;UI", "ODATA;V4;WEB_API"])
|
|
354
|
+
.optional()
|
|
355
|
+
.describe("Protocolo do Service Binding. Padrão: ODATA;V4;UI."),
|
|
356
|
+
transport_request: zod_1.z
|
|
357
|
+
.string()
|
|
358
|
+
.optional()
|
|
359
|
+
.describe("Ordem de transporte para todos os objetos criados."),
|
|
360
|
+
}, async ({ base_name, description, scenario, child_entities, with_feature_control, with_business_events, package: pkg, binding_type, transport_request }) => {
|
|
361
|
+
try {
|
|
362
|
+
const result = await (0, scaffold_rap_js_1.abapScaffoldRap)({ base_name, description, scenario, child_entities, with_feature_control, with_business_events, package: pkg, binding_type, transport_request });
|
|
363
|
+
return {
|
|
364
|
+
content: [{ type: "text", text: result }],
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
369
|
+
return {
|
|
370
|
+
content: [{ type: "text", text: `Erro no scaffold RAP: ${message}` }],
|
|
371
|
+
isError: true,
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
// Tool: abap_publish_binding
|
|
376
|
+
server.tool("abap_publish_binding", "Publica uma Service Binding (SRVB/SVB) no SAP Gateway, tornando o serviço OData acessível. Equivalente ao 'Publish' do Eclipse ADT. Requer que a binding já esteja ativa (abap_activate).", {
|
|
377
|
+
binding_name: zod_1.z
|
|
378
|
+
.string()
|
|
379
|
+
.describe("Nome da Service Binding a publicar (ex: ZSRVB_SD_PEDIDOS)."),
|
|
380
|
+
service_version: zod_1.z
|
|
381
|
+
.string()
|
|
382
|
+
.optional()
|
|
383
|
+
.describe("Versão do serviço no Gateway (padrão: '0001')."),
|
|
384
|
+
}, async ({ binding_name, service_version }) => {
|
|
385
|
+
try {
|
|
386
|
+
const result = await (0, publish_binding_js_1.abapPublishBinding)({ binding_name, service_version });
|
|
387
|
+
return {
|
|
388
|
+
content: [{ type: "text", text: result }],
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
393
|
+
return {
|
|
394
|
+
content: [{ type: "text", text: `Erro ao publicar Service Binding: ${message}` }],
|
|
395
|
+
isError: true,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
// Tool: abap_deploy_bsp
|
|
400
|
+
server.tool("abap_deploy_bsp", "Faz deploy de uma aplicação Fiori/UI5 para o ABAP Repository (BSP) no sistema SAP. Envia os arquivos de uma pasta local como ZIP para o SAP via OData ABAP_REPOSITORY_SRV. Cria ou atualiza a BSP automaticamente.", {
|
|
401
|
+
bsp_name: zod_1.z
|
|
402
|
+
.string()
|
|
403
|
+
.describe("Nome da aplicação BSP no SAP (max 15 caracteres, ex: ZVENDASHOJE). Será convertido para maiúsculas."),
|
|
404
|
+
folder_path: zod_1.z
|
|
405
|
+
.string()
|
|
406
|
+
.describe("Caminho absoluto da pasta local com os arquivos da aplicação (ex: /Users/dev/myapp/dist). Deve conter manifest.json, Component.js, etc."),
|
|
407
|
+
package: zod_1.z
|
|
408
|
+
.string()
|
|
409
|
+
.optional()
|
|
410
|
+
.describe("Pacote ABAP. Padrão: '$TMP' (objeto local). Para objetos permanentes use um pacote Z."),
|
|
411
|
+
description: zod_1.z
|
|
412
|
+
.string()
|
|
413
|
+
.optional()
|
|
414
|
+
.describe("Descrição da aplicação BSP (aparece no SE80/ADT)."),
|
|
415
|
+
transport_request: zod_1.z
|
|
416
|
+
.string()
|
|
417
|
+
.optional()
|
|
418
|
+
.describe("Ordem de transporte (ex: ECDK900123). Obrigatória se o pacote não for $TMP."),
|
|
419
|
+
}, async ({ bsp_name, folder_path, package: pkg, description, transport_request }) => {
|
|
420
|
+
try {
|
|
421
|
+
const result = await (0, deploy_bsp_js_1.abapDeployBsp)({ bsp_name, folder_path, package: pkg, description, transport_request });
|
|
422
|
+
return {
|
|
423
|
+
content: [{ type: "text", text: result }],
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
428
|
+
return {
|
|
429
|
+
content: [{ type: "text", text: `Erro no deploy BSP: ${message}` }],
|
|
430
|
+
isError: true,
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
// Tool: abap_system_info
|
|
435
|
+
server.tool("abap_system_info", "Detecta automaticamente as características do sistema SAP conectado: tipo (S/4HANA on-prem, BTP, ECC), release, versão ABAP, topologia gateway, tipo de mandante, e quirks conhecidos. O resultado é aplicado como System Profile para adaptar o comportamento de todas as outras tools. Execute esta tool no início de cada sessão para configurar o MCP automaticamente.", {}, async () => {
|
|
436
|
+
try {
|
|
437
|
+
const result = await (0, system_info_js_1.abapSystemInfo)();
|
|
438
|
+
return {
|
|
439
|
+
content: [{ type: "text", text: result }],
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
444
|
+
return {
|
|
445
|
+
content: [{ type: "text", text: `Erro na detecção do sistema: ${message}` }],
|
|
446
|
+
isError: true,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
// Tool: abap_object_structure
|
|
451
|
+
server.tool("abap_object_structure", "Retorna a estrutura de uma classe ou interface ABAP: métodos, atributos e interfaces implementadas com visibilidade.", {
|
|
452
|
+
object_type: zod_1.z
|
|
453
|
+
.enum(["CLAS/OC", "INTF/OI"])
|
|
454
|
+
.describe("Tipo do objeto. Apenas CLAS/OC (classe) ou INTF/OI (interface)."),
|
|
455
|
+
object_name: zod_1.z
|
|
456
|
+
.string()
|
|
457
|
+
.describe("Nome da classe ou interface (ex: ZCL_SD_HELPER)."),
|
|
458
|
+
}, async ({ object_type, object_name }) => {
|
|
459
|
+
try {
|
|
460
|
+
const result = await (0, object_structure_js_1.abapObjectStructure)({ object_type, object_name });
|
|
461
|
+
return {
|
|
462
|
+
content: [{ type: "text", text: result }],
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
467
|
+
return {
|
|
468
|
+
content: [{ type: "text", text: `Erro ao ler estrutura: ${message}` }],
|
|
469
|
+
isError: true,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
// Tool: abap_data_preview
|
|
474
|
+
server.tool("abap_data_preview", "Visualiza dados de uma tabela transparente ou CDS view no SAP. Retorna as primeiras N linhas em formato tabular. Suporta filtros WHERE, ORDER BY e seleção de colunas.", {
|
|
475
|
+
object_name: zod_1.z
|
|
476
|
+
.string()
|
|
477
|
+
.describe("Nome da tabela ou CDS view (ex: MARA, ZI_SD_PEDIDOS)."),
|
|
478
|
+
max_rows: zod_1.z
|
|
479
|
+
.number()
|
|
480
|
+
.optional()
|
|
481
|
+
.describe("Número máximo de linhas retornadas (padrão: 100)."),
|
|
482
|
+
where_clause: zod_1.z
|
|
483
|
+
.string()
|
|
484
|
+
.optional()
|
|
485
|
+
.describe("Filtro WHERE (ex: MATNR = 'Z001' AND MTART = 'FERT')."),
|
|
486
|
+
order_by: zod_1.z
|
|
487
|
+
.string()
|
|
488
|
+
.optional()
|
|
489
|
+
.describe("Ordenação (ex: MATNR ASCENDING)."),
|
|
490
|
+
columns: zod_1.z
|
|
491
|
+
.string()
|
|
492
|
+
.optional()
|
|
493
|
+
.describe("Colunas a retornar, separadas por vírgula (ex: MATNR,MTART,MBRSH)."),
|
|
494
|
+
}, async ({ object_name, max_rows, where_clause, order_by, columns }) => {
|
|
495
|
+
try {
|
|
496
|
+
const result = await (0, data_preview_js_1.abapDataPreview)({ object_name, max_rows, where_clause, order_by, columns });
|
|
497
|
+
return {
|
|
498
|
+
content: [{ type: "text", text: result }],
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
catch (error) {
|
|
502
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
503
|
+
return {
|
|
504
|
+
content: [{ type: "text", text: `Erro no data preview: ${message}` }],
|
|
505
|
+
isError: true,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
// Tool: abap_element_info
|
|
510
|
+
server.tool("abap_element_info", "Retorna informações sobre um elemento de código ABAP em uma posição específica (tipo, assinatura, parâmetros). Útil para entender APIs e tipos.", {
|
|
511
|
+
object_type: zod_1.z
|
|
512
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI", "DDLS/DF"])
|
|
513
|
+
.describe("Tipo do objeto que contém o código."),
|
|
514
|
+
object_name: zod_1.z
|
|
515
|
+
.string()
|
|
516
|
+
.describe("Nome do objeto ABAP."),
|
|
517
|
+
line: zod_1.z
|
|
518
|
+
.number()
|
|
519
|
+
.describe("Número da linha no código-fonte (1-based)."),
|
|
520
|
+
column: zod_1.z
|
|
521
|
+
.number()
|
|
522
|
+
.describe("Número da coluna no código-fonte (1-based)."),
|
|
523
|
+
class_include: zod_1.z
|
|
524
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
525
|
+
.optional()
|
|
526
|
+
.describe("Include da classe. Apenas para CLAS/OC. Padrão: main."),
|
|
527
|
+
}, async ({ object_type, object_name, line, column, class_include }) => {
|
|
528
|
+
try {
|
|
529
|
+
const result = await (0, element_info_js_1.abapElementInfo)({ object_type, object_name, line, column, class_include });
|
|
530
|
+
return {
|
|
531
|
+
content: [{ type: "text", text: result }],
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
catch (error) {
|
|
535
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
536
|
+
return {
|
|
537
|
+
content: [{ type: "text", text: `Erro ao obter element info: ${message}` }],
|
|
538
|
+
isError: true,
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
// Tool: abap_pretty_printer
|
|
543
|
+
server.tool("abap_pretty_printer", "Formata código-fonte ABAP usando o Pretty Printer do SAP. Envia o source code e retorna a versão formatada/indentada.", {
|
|
544
|
+
source: zod_1.z
|
|
545
|
+
.string()
|
|
546
|
+
.describe("Código-fonte ABAP a ser formatado."),
|
|
547
|
+
}, async ({ source }) => {
|
|
548
|
+
try {
|
|
549
|
+
const result = await (0, pretty_printer_js_1.abapPrettyPrinter)({ source });
|
|
550
|
+
return {
|
|
551
|
+
content: [{ type: "text", text: result }],
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
556
|
+
return {
|
|
557
|
+
content: [{ type: "text", text: `Erro no Pretty Printer: ${message}` }],
|
|
558
|
+
isError: true,
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
// Tool: abap_unit_test
|
|
563
|
+
server.tool("abap_unit_test", "Executa testes unitários ABAP (ABAP Unit) de um objeto e retorna os resultados: classes de teste, métodos, status (pass/fail) e detalhes de falhas.", {
|
|
564
|
+
object_type: zod_1.z
|
|
565
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI"])
|
|
566
|
+
.describe("Tipo do objeto que contém os testes."),
|
|
567
|
+
object_name: zod_1.z
|
|
568
|
+
.string()
|
|
569
|
+
.describe("Nome do objeto ABAP (ex: ZCL_SD_HELPER)."),
|
|
570
|
+
}, async ({ object_type, object_name }) => {
|
|
571
|
+
try {
|
|
572
|
+
const result = await (0, unit_test_js_1.abapUnitTest)({ object_type, object_name });
|
|
573
|
+
return {
|
|
574
|
+
content: [{ type: "text", text: result }],
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
catch (error) {
|
|
578
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
579
|
+
return {
|
|
580
|
+
content: [{ type: "text", text: `Erro ao executar ABAP Unit: ${message}` }],
|
|
581
|
+
isError: true,
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
// Tool: abap_atc_check
|
|
586
|
+
server.tool("abap_atc_check", "Executa verificação ATC (ABAP Test Cockpit) em um objeto ABAP. Retorna findings com prioridade (erro/aviso/info), mensagem e linha.", {
|
|
587
|
+
object_type: zod_1.z
|
|
588
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "FUGR/F", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
589
|
+
.describe("Tipo do objeto SAP."),
|
|
590
|
+
object_name: zod_1.z
|
|
591
|
+
.string()
|
|
592
|
+
.describe("Nome do objeto ABAP (ex: ZCL_SD_HELPER)."),
|
|
593
|
+
}, async ({ object_type, object_name }) => {
|
|
594
|
+
try {
|
|
595
|
+
const result = await (0, atc_check_js_1.abapAtcCheck)({ object_type, object_name });
|
|
596
|
+
return {
|
|
597
|
+
content: [{ type: "text", text: result }],
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
602
|
+
return {
|
|
603
|
+
content: [{ type: "text", text: `Erro ao executar ATC: ${message}` }],
|
|
604
|
+
isError: true,
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
// Tool: abap_package_contents
|
|
609
|
+
server.tool("abap_package_contents", "Lista todos os objetos dentro de um pacote ABAP (DEVC). Retorna nome, tipo e descrição de cada objeto.", {
|
|
610
|
+
package_name: zod_1.z
|
|
611
|
+
.string()
|
|
612
|
+
.describe("Nome do pacote ABAP (ex: ZDEV, $TMP, Z_SD_PEDIDOS)."),
|
|
613
|
+
}, async ({ package_name }) => {
|
|
614
|
+
try {
|
|
615
|
+
const result = await (0, package_contents_js_1.abapPackageContents)({ package_name });
|
|
616
|
+
return {
|
|
617
|
+
content: [{ type: "text", text: result }],
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
catch (error) {
|
|
621
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
622
|
+
return {
|
|
623
|
+
content: [{ type: "text", text: `Erro ao listar pacote: ${message}` }],
|
|
624
|
+
isError: true,
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
// Tool: abap_object_versions
|
|
629
|
+
server.tool("abap_object_versions", "Retorna o histórico de versões de um objeto ABAP: número da versão, data, autor e descrição.", {
|
|
630
|
+
object_type: zod_1.z
|
|
631
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "FUGR/F", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "MSAG/N", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
632
|
+
.describe("Tipo do objeto SAP."),
|
|
633
|
+
object_name: zod_1.z
|
|
634
|
+
.string()
|
|
635
|
+
.describe("Nome do objeto ABAP."),
|
|
636
|
+
}, async ({ object_type, object_name }) => {
|
|
637
|
+
try {
|
|
638
|
+
const result = await (0, object_versions_js_1.abapObjectVersions)({ object_type, object_name });
|
|
639
|
+
return {
|
|
640
|
+
content: [{ type: "text", text: result }],
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
catch (error) {
|
|
644
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
645
|
+
return {
|
|
646
|
+
content: [{ type: "text", text: `Erro ao listar versões: ${message}` }],
|
|
647
|
+
isError: true,
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
// Tool: abap_function_group
|
|
652
|
+
server.tool("abap_function_group", "Lista todos os function modules dentro de um grupo de funções ABAP.", {
|
|
653
|
+
group_name: zod_1.z
|
|
654
|
+
.string()
|
|
655
|
+
.describe("Nome do grupo de funções (ex: J_1B_NFE, SMOD)."),
|
|
656
|
+
}, async ({ group_name }) => {
|
|
657
|
+
try {
|
|
658
|
+
const result = await (0, function_group_js_1.abapFunctionGroup)({ group_name });
|
|
659
|
+
return {
|
|
660
|
+
content: [{ type: "text", text: result }],
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
catch (error) {
|
|
664
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
665
|
+
return {
|
|
666
|
+
content: [{ type: "text", text: `Erro ao listar grupo de funções: ${message}` }],
|
|
667
|
+
isError: true,
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
// Tool: abap_message_class
|
|
672
|
+
server.tool("abap_message_class", "Lê todas as mensagens de uma classe de mensagem SAP (T100). Retorna número e texto de cada mensagem.", {
|
|
673
|
+
message_class_name: zod_1.z
|
|
674
|
+
.string()
|
|
675
|
+
.describe("Nome da classe de mensagem (ex: 00, ZDEV_MSG)."),
|
|
676
|
+
}, async ({ message_class_name }) => {
|
|
677
|
+
try {
|
|
678
|
+
const result = await (0, message_class_js_1.abapMessageClass)({ message_class_name });
|
|
679
|
+
return {
|
|
680
|
+
content: [{ type: "text", text: result }],
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
catch (error) {
|
|
684
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
685
|
+
return {
|
|
686
|
+
content: [{ type: "text", text: `Erro ao ler classe de mensagem: ${message}` }],
|
|
687
|
+
isError: true,
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
// Tool: abap_doc
|
|
692
|
+
server.tool("abap_doc", "Lê a documentação ABAP Doc (inline) de uma classe, interface ou método.", {
|
|
693
|
+
object_type: zod_1.z
|
|
694
|
+
.enum(["CLAS/OC", "INTF/OI", "PROG/P", "FUGR/FF"])
|
|
695
|
+
.describe("Tipo do objeto."),
|
|
696
|
+
object_name: zod_1.z
|
|
697
|
+
.string()
|
|
698
|
+
.describe("Nome do objeto ABAP (ex: ZCL_SD_HELPER)."),
|
|
699
|
+
method_name: zod_1.z
|
|
700
|
+
.string()
|
|
701
|
+
.optional()
|
|
702
|
+
.describe("Nome do método específico (opcional). Se omitido, retorna doc da classe/interface."),
|
|
703
|
+
}, async ({ object_type, object_name, method_name }) => {
|
|
704
|
+
try {
|
|
705
|
+
const result = await (0, abap_doc_js_1.abapDoc)({ object_type, object_name, method_name });
|
|
706
|
+
return {
|
|
707
|
+
content: [{ type: "text", text: result }],
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
catch (error) {
|
|
711
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
712
|
+
return {
|
|
713
|
+
content: [{ type: "text", text: `Erro ao ler ABAP Doc: ${message}` }],
|
|
714
|
+
isError: true,
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
// Tool: abap_release_transport
|
|
719
|
+
server.tool("abap_release_transport", "Libera uma ordem de transporte no SAP. ATENÇÃO: operação irreversível — a ordem será enviada para o sistema de destino.", {
|
|
720
|
+
transport_request: zod_1.z
|
|
721
|
+
.string()
|
|
722
|
+
.describe("Número da ordem de transporte a liberar (ex: ECDK900123)."),
|
|
723
|
+
}, async ({ transport_request }) => {
|
|
724
|
+
try {
|
|
725
|
+
const result = await (0, release_transport_js_1.abapReleaseTransport)({ transport_request });
|
|
726
|
+
return {
|
|
727
|
+
content: [{ type: "text", text: result }],
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
catch (error) {
|
|
731
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
732
|
+
return {
|
|
733
|
+
content: [{ type: "text", text: `Erro ao liberar transporte: ${message}` }],
|
|
734
|
+
isError: true,
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
// Tool: abap_delete
|
|
739
|
+
server.tool("abap_delete", "Exclui um objeto ABAP do sistema SAP. ATENÇÃO: operação irreversível. Requer transporte para objetos em pacotes não-locais.", {
|
|
740
|
+
object_type: zod_1.z
|
|
741
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "DOMA/D", "DTEL/D", "TABL/DT", "TABL/DS", "TTYP/TT", "INTF/OI", "DDLS/DF", "DDLX/MX", "SRVD/SRV", "BDEF/BDO", "SRVB/SVB"])
|
|
742
|
+
.describe("Tipo do objeto SAP a excluir."),
|
|
743
|
+
object_name: zod_1.z
|
|
744
|
+
.string()
|
|
745
|
+
.describe("Nome do objeto ABAP a excluir."),
|
|
746
|
+
transport_request: zod_1.z
|
|
747
|
+
.string()
|
|
748
|
+
.optional()
|
|
749
|
+
.describe("Ordem de transporte (obrigatória para objetos em pacotes não-locais)."),
|
|
750
|
+
}, async ({ object_type, object_name, transport_request }) => {
|
|
751
|
+
try {
|
|
752
|
+
const result = await (0, delete_js_1.abapDeleteObject)({ object_type, object_name, transport_request });
|
|
753
|
+
return {
|
|
754
|
+
content: [{ type: "text", text: result }],
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
catch (error) {
|
|
758
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
759
|
+
return {
|
|
760
|
+
content: [{ type: "text", text: `Erro ao excluir objeto: ${message}` }],
|
|
761
|
+
isError: true,
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
// Tool: abap_refactor_rename
|
|
766
|
+
server.tool("abap_refactor_rename", "Renomeia um símbolo (variável, método, atributo) em um objeto ABAP usando o refactoring ADT. Aplica a renomeação em todas as referências.", {
|
|
767
|
+
object_type: zod_1.z
|
|
768
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI"])
|
|
769
|
+
.describe("Tipo do objeto que contém o símbolo."),
|
|
770
|
+
object_name: zod_1.z
|
|
771
|
+
.string()
|
|
772
|
+
.describe("Nome do objeto ABAP."),
|
|
773
|
+
old_name: zod_1.z
|
|
774
|
+
.string()
|
|
775
|
+
.describe("Nome atual do símbolo a renomear."),
|
|
776
|
+
new_name: zod_1.z
|
|
777
|
+
.string()
|
|
778
|
+
.describe("Novo nome para o símbolo."),
|
|
779
|
+
line: zod_1.z
|
|
780
|
+
.number()
|
|
781
|
+
.describe("Linha onde o símbolo aparece no código (1-based)."),
|
|
782
|
+
column: zod_1.z
|
|
783
|
+
.number()
|
|
784
|
+
.describe("Coluna onde o símbolo aparece no código (1-based)."),
|
|
785
|
+
class_include: zod_1.z
|
|
786
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
787
|
+
.optional()
|
|
788
|
+
.describe("Include da classe. Apenas para CLAS/OC. Padrão: main."),
|
|
789
|
+
}, async ({ object_type, object_name, old_name, new_name, line, column, class_include }) => {
|
|
790
|
+
try {
|
|
791
|
+
const result = await (0, refactor_rename_js_1.abapRefactorRename)({ object_type, object_name, old_name, new_name, line, column, class_include });
|
|
792
|
+
return {
|
|
793
|
+
content: [{ type: "text", text: result }],
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
catch (error) {
|
|
797
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
798
|
+
return {
|
|
799
|
+
content: [{ type: "text", text: `Erro na renomeação: ${message}` }],
|
|
800
|
+
isError: true,
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
805
|
+
// NOVAS TOOLS v2.0 — Code Intelligence, Refactoring, SQL, CDS, etc.
|
|
806
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
807
|
+
// Tool: abap_code_completion
|
|
808
|
+
server.tool("abap_code_completion", "Retorna sugestões de auto-completar (code completion) para uma posição no código ABAP. Útil para validar nomes de tipos, métodos e variáveis.", {
|
|
809
|
+
object_type: zod_1.z
|
|
810
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI", "DDLS/DF"])
|
|
811
|
+
.describe("Tipo do objeto que contém o código."),
|
|
812
|
+
object_name: zod_1.z.string().describe("Nome do objeto ABAP."),
|
|
813
|
+
line: zod_1.z.number().describe("Número da linha (1-based)."),
|
|
814
|
+
column: zod_1.z.number().describe("Número da coluna (1-based)."),
|
|
815
|
+
class_include: zod_1.z
|
|
816
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
817
|
+
.optional()
|
|
818
|
+
.describe("Include da classe. Apenas para CLAS/OC."),
|
|
819
|
+
}, async ({ object_type, object_name, line, column, class_include }) => {
|
|
820
|
+
try {
|
|
821
|
+
const result = await (0, code_completion_js_1.abapCodeCompletion)({ object_type, object_name, line, column, class_include });
|
|
822
|
+
return { content: [{ type: "text", text: result }] };
|
|
823
|
+
}
|
|
824
|
+
catch (error) {
|
|
825
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
826
|
+
return { content: [{ type: "text", text: `Erro no code completion: ${message}` }], isError: true };
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
// Tool: abap_navigate
|
|
830
|
+
server.tool("abap_navigate", "Navega para a definição de um elemento ABAP (Go to Definition). Retorna URI, tipo e posição no código-fonte.", {
|
|
831
|
+
uri: zod_1.z.string().describe("URI ADT do objeto de origem (obtida via abap_element_info ou abap_code_completion)."),
|
|
832
|
+
}, async ({ uri }) => {
|
|
833
|
+
try {
|
|
834
|
+
const result = await (0, navigate_js_1.abapNavigate)({ uri });
|
|
835
|
+
return { content: [{ type: "text", text: result }] };
|
|
836
|
+
}
|
|
837
|
+
catch (error) {
|
|
838
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
839
|
+
return { content: [{ type: "text", text: `Erro na navegação: ${message}` }], isError: true };
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
// Tool: abap_call_hierarchy
|
|
843
|
+
server.tool("abap_call_hierarchy", "Retorna a hierarquia de chamadas de um método ou function module. Mostra quem chama (callers) e quem é chamado (callees).", {
|
|
844
|
+
object_type: zod_1.z
|
|
845
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI"])
|
|
846
|
+
.describe("Tipo do objeto."),
|
|
847
|
+
object_name: zod_1.z.string().describe("Nome do objeto ABAP."),
|
|
848
|
+
method_name: zod_1.z.string().optional().describe("Nome do método específico (opcional)."),
|
|
849
|
+
direction: zod_1.z
|
|
850
|
+
.enum(["callers", "callees"])
|
|
851
|
+
.optional()
|
|
852
|
+
.describe("Direção: 'callers' (quem chama) ou 'callees' (quem é chamado). Padrão: callers."),
|
|
853
|
+
class_include: zod_1.z
|
|
854
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
855
|
+
.optional()
|
|
856
|
+
.describe("Include da classe. Apenas para CLAS/OC."),
|
|
857
|
+
}, async ({ object_type, object_name, method_name, direction, class_include }) => {
|
|
858
|
+
try {
|
|
859
|
+
const result = await (0, call_hierarchy_js_1.abapCallHierarchy)({ object_type, object_name, method_name, direction, class_include });
|
|
860
|
+
return { content: [{ type: "text", text: result }] };
|
|
861
|
+
}
|
|
862
|
+
catch (error) {
|
|
863
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
864
|
+
return { content: [{ type: "text", text: `Erro no call hierarchy: ${message}` }], isError: true };
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
// Tool: abap_quick_fix
|
|
868
|
+
server.tool("abap_quick_fix", "Obtém e aplica correções rápidas (quick fixes) para erros/avisos no código ABAP. Sem fix_index lista os fixes; com fix_index aplica o fix escolhido.", {
|
|
869
|
+
object_type: zod_1.z
|
|
870
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI", "DDLS/DF"])
|
|
871
|
+
.describe("Tipo do objeto."),
|
|
872
|
+
object_name: zod_1.z.string().describe("Nome do objeto ABAP."),
|
|
873
|
+
line: zod_1.z.number().describe("Número da linha do erro (1-based)."),
|
|
874
|
+
column: zod_1.z.number().describe("Número da coluna do erro (1-based)."),
|
|
875
|
+
fix_index: zod_1.z.number().optional().describe("Índice do fix a aplicar (0-based). Se omitido, lista os fixes disponíveis."),
|
|
876
|
+
class_include: zod_1.z
|
|
877
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
878
|
+
.optional()
|
|
879
|
+
.describe("Include da classe. Apenas para CLAS/OC."),
|
|
880
|
+
transport_request: zod_1.z.string().optional().describe("Ordem de transporte para aplicar o fix."),
|
|
881
|
+
}, async ({ object_type, object_name, line, column, fix_index, class_include, transport_request }) => {
|
|
882
|
+
try {
|
|
883
|
+
const result = await (0, quick_fix_js_1.abapQuickFix)({ object_type, object_name, line, column, fix_index, class_include, transport_request });
|
|
884
|
+
return { content: [{ type: "text", text: result }] };
|
|
885
|
+
}
|
|
886
|
+
catch (error) {
|
|
887
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
888
|
+
return { content: [{ type: "text", text: `Erro no quick fix: ${message}` }], isError: true };
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
// Tool: abap_extract_method
|
|
892
|
+
server.tool("abap_extract_method", "Extrai um trecho de código ABAP selecionado para um novo método (Extract Method refactoring).", {
|
|
893
|
+
object_type: zod_1.z
|
|
894
|
+
.enum(["CLAS/OC", "PROG/P"])
|
|
895
|
+
.describe("Tipo do objeto."),
|
|
896
|
+
object_name: zod_1.z.string().describe("Nome do objeto ABAP."),
|
|
897
|
+
start_line: zod_1.z.number().describe("Linha inicial do trecho a extrair (1-based)."),
|
|
898
|
+
end_line: zod_1.z.number().describe("Linha final do trecho a extrair (1-based)."),
|
|
899
|
+
new_method_name: zod_1.z.string().describe("Nome do novo método a criar."),
|
|
900
|
+
class_include: zod_1.z
|
|
901
|
+
.enum(["main", "locals_def", "locals_imp", "testclasses", "macros"])
|
|
902
|
+
.optional()
|
|
903
|
+
.describe("Include da classe. Apenas para CLAS/OC."),
|
|
904
|
+
transport_request: zod_1.z.string().optional().describe("Ordem de transporte (se necessário)."),
|
|
905
|
+
}, async ({ object_type, object_name, start_line, end_line, new_method_name, class_include, transport_request }) => {
|
|
906
|
+
try {
|
|
907
|
+
const result = await (0, extract_method_js_1.abapExtractMethod)({ object_type, object_name, start_line, end_line, new_method_name, class_include, transport_request });
|
|
908
|
+
return { content: [{ type: "text", text: result }] };
|
|
909
|
+
}
|
|
910
|
+
catch (error) {
|
|
911
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
912
|
+
return { content: [{ type: "text", text: `Erro no extract method: ${message}` }], isError: true };
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
// Tool: abap_code_coverage
|
|
916
|
+
server.tool("abap_code_coverage", "Executa testes unitários ABAP com cobertura de código (code coverage). Retorna percentual de cobertura, linhas cobertas/não cobertas e resultados dos testes.", {
|
|
917
|
+
object_type: zod_1.z
|
|
918
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI"])
|
|
919
|
+
.describe("Tipo do objeto que contém os testes."),
|
|
920
|
+
object_name: zod_1.z.string().describe("Nome do objeto ABAP."),
|
|
921
|
+
}, async ({ object_type, object_name }) => {
|
|
922
|
+
try {
|
|
923
|
+
const result = await (0, code_coverage_js_1.abapCodeCoverage)({ object_type, object_name });
|
|
924
|
+
return { content: [{ type: "text", text: result }] };
|
|
925
|
+
}
|
|
926
|
+
catch (error) {
|
|
927
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
928
|
+
return { content: [{ type: "text", text: `Erro no code coverage: ${message}` }], isError: true };
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
// Tool: abap_sql_console
|
|
932
|
+
server.tool("abap_sql_console", "Executa uma consulta ABAP SQL (Open SQL) no sistema SAP e retorna o resultado em formato tabular. Suporta SELECT com WHERE, ORDER BY, GROUP BY e agregações. Apenas leitura.", {
|
|
933
|
+
sql: zod_1.z.string().describe("Consulta ABAP SQL. Ex: SELECT * FROM mara WHERE matnr LIKE 'Z%' ORDER BY matnr UP TO 100 ROWS"),
|
|
934
|
+
max_rows: zod_1.z.number().optional().describe("Número máximo de linhas retornadas (padrão: 100)."),
|
|
935
|
+
}, async ({ sql, max_rows }) => {
|
|
936
|
+
try {
|
|
937
|
+
const result = await (0, sql_console_js_1.abapSqlConsole)({ sql, max_rows });
|
|
938
|
+
return { content: [{ type: "text", text: result }] };
|
|
939
|
+
}
|
|
940
|
+
catch (error) {
|
|
941
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
942
|
+
return { content: [{ type: "text", text: `Erro no SQL Console: ${message}` }], isError: true };
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
// Tool: abap_transport_contents
|
|
946
|
+
server.tool("abap_transport_contents", "Retorna o conteúdo detalhado de uma ordem de transporte: objetos incluídos, tasks, owner e status.", {
|
|
947
|
+
transport_request: zod_1.z.string().describe("Número da ordem de transporte (ex: ECDK900123)."),
|
|
948
|
+
}, async ({ transport_request }) => {
|
|
949
|
+
try {
|
|
950
|
+
const result = await (0, transport_contents_js_1.abapTransportContents)({ transport_request });
|
|
951
|
+
return { content: [{ type: "text", text: result }] };
|
|
952
|
+
}
|
|
953
|
+
catch (error) {
|
|
954
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
955
|
+
return { content: [{ type: "text", text: `Erro ao ler transporte: ${message}` }], isError: true };
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
// Tool: abap_create_transport
|
|
959
|
+
server.tool("abap_create_transport", "Cria uma nova ordem de transporte (workbench ou customizing) no sistema SAP.", {
|
|
960
|
+
description: zod_1.z.string().describe("Descrição da ordem de transporte."),
|
|
961
|
+
type: zod_1.z.enum(["W", "K"]).optional().describe("Tipo: W=Workbench (padrão), K=Customizing."),
|
|
962
|
+
target: zod_1.z.string().optional().describe("Sistema de destino (ex: QAS). Opcional."),
|
|
963
|
+
}, async ({ description, type, target }) => {
|
|
964
|
+
try {
|
|
965
|
+
const result = await (0, create_transport_js_1.abapCreateTransport)({ description, type, target });
|
|
966
|
+
return { content: [{ type: "text", text: result }] };
|
|
967
|
+
}
|
|
968
|
+
catch (error) {
|
|
969
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
970
|
+
return { content: [{ type: "text", text: `Erro ao criar transporte: ${message}` }], isError: true };
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
// Tool: abap_cds_annotations
|
|
974
|
+
server.tool("abap_cds_annotations", "Lista definições de anotações CDS disponíveis no sistema SAP. Útil para validar anotações em CDS views.", {
|
|
975
|
+
filter: zod_1.z.string().optional().describe("Filtro por nome de anotação (ex: 'UI.*', 'ObjectModel.*')."),
|
|
976
|
+
}, async ({ filter }) => {
|
|
977
|
+
try {
|
|
978
|
+
const result = await (0, cds_annotations_js_1.abapCdsAnnotations)({ filter });
|
|
979
|
+
return { content: [{ type: "text", text: result }] };
|
|
980
|
+
}
|
|
981
|
+
catch (error) {
|
|
982
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
983
|
+
return { content: [{ type: "text", text: `Erro ao listar anotações CDS: ${message}` }], isError: true };
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
// Tool: abap_cds_dependencies
|
|
987
|
+
server.tool("abap_cds_dependencies", "Retorna o grafo de dependências de uma CDS view: views base consumidas e views que a consomem.", {
|
|
988
|
+
object_name: zod_1.z.string().describe("Nome da CDS view (ex: ZI_SD_PEDIDOS)."),
|
|
989
|
+
direction: zod_1.z
|
|
990
|
+
.enum(["uses", "used_by", "both"])
|
|
991
|
+
.optional()
|
|
992
|
+
.describe("Direção: 'uses' (dependências), 'used_by' (dependentes), 'both' (ambos). Padrão: both."),
|
|
993
|
+
}, async ({ object_name, direction }) => {
|
|
994
|
+
try {
|
|
995
|
+
const result = await (0, cds_dependencies_js_1.abapCdsDependencies)({ object_name, direction });
|
|
996
|
+
return { content: [{ type: "text", text: result }] };
|
|
997
|
+
}
|
|
998
|
+
catch (error) {
|
|
999
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1000
|
+
return { content: [{ type: "text", text: `Erro nas dependências CDS: ${message}` }], isError: true };
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
// Tool: abap_annotation_propagation
|
|
1004
|
+
server.tool("abap_annotation_propagation", "Verifica como anotações CDS propagam através do stack de views (propagation analysis).", {
|
|
1005
|
+
object_name: zod_1.z.string().describe("Nome da CDS view (ex: ZI_SD_PEDIDOS)."),
|
|
1006
|
+
}, async ({ object_name }) => {
|
|
1007
|
+
try {
|
|
1008
|
+
const result = await (0, cds_annotations_js_1.abapAnnotationPropagation)({ object_name });
|
|
1009
|
+
return { content: [{ type: "text", text: result }] };
|
|
1010
|
+
}
|
|
1011
|
+
catch (error) {
|
|
1012
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1013
|
+
return { content: [{ type: "text", text: `Erro na propagação de anotações: ${message}` }], isError: true };
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
// Tool: abap_enhancement_spot
|
|
1017
|
+
server.tool("abap_enhancement_spot", "Lê enhancement spots e suas implementações no SAP. Mostra BAdIs com informação de single-use/multi-use e implementações existentes. IMPORTANTE: sempre consulte ANTES de criar uma nova implementação — BAdIs single-use só permitem UMA implementação. Se já existir, modifique a existente.", {
|
|
1018
|
+
name: zod_1.z.string().describe("Nome do enhancement spot ou implementation (ex: BADI_MATERIAL_CHECK)."),
|
|
1019
|
+
type: zod_1.z
|
|
1020
|
+
.enum(["spot", "implementation"])
|
|
1021
|
+
.optional()
|
|
1022
|
+
.describe("Tipo: 'spot' (enhancement spot) ou 'implementation' (enhancement implementation). Padrão: spot."),
|
|
1023
|
+
}, async ({ name, type }) => {
|
|
1024
|
+
try {
|
|
1025
|
+
const result = await (0, enhancements_js_1.abapEnhancementSpot)({ name, type });
|
|
1026
|
+
return { content: [{ type: "text", text: result }] };
|
|
1027
|
+
}
|
|
1028
|
+
catch (error) {
|
|
1029
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1030
|
+
return { content: [{ type: "text", text: `Erro ao ler enhancement: ${message}` }], isError: true };
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
// Tool: abap_lock_object
|
|
1034
|
+
server.tool("abap_lock_object", "Lê a definição de um lock object (enqueue) do dicionário ABAP: tabelas, parâmetros e modo de bloqueio.", {
|
|
1035
|
+
object_name: zod_1.z.string().describe("Nome do lock object (ex: EZ_MARA)."),
|
|
1036
|
+
}, async ({ object_name }) => {
|
|
1037
|
+
try {
|
|
1038
|
+
const result = await (0, lock_object_js_1.abapLockObject)({ object_name });
|
|
1039
|
+
return { content: [{ type: "text", text: result }] };
|
|
1040
|
+
}
|
|
1041
|
+
catch (error) {
|
|
1042
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1043
|
+
return { content: [{ type: "text", text: `Erro ao ler lock object: ${message}` }], isError: true };
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
// Tool: abap_auth_object
|
|
1047
|
+
server.tool("abap_auth_object", "Lê a definição de um objeto de autorização SAP: campos e indicadores de verificação.", {
|
|
1048
|
+
object_name: zod_1.z.string().describe("Nome do objeto de autorização (ex: S_TCODE, Z_VENDAS)."),
|
|
1049
|
+
}, async ({ object_name }) => {
|
|
1050
|
+
try {
|
|
1051
|
+
const result = await (0, auth_object_js_1.abapAuthObject)({ object_name });
|
|
1052
|
+
return { content: [{ type: "text", text: result }] };
|
|
1053
|
+
}
|
|
1054
|
+
catch (error) {
|
|
1055
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1056
|
+
return { content: [{ type: "text", text: `Erro ao ler objeto de autorização: ${message}` }], isError: true };
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
// Tool: abap_number_range
|
|
1060
|
+
server.tool("abap_number_range", "Lê a configuração de um objeto de numeração (number range): intervalos, numeração interna/externa.", {
|
|
1061
|
+
object_name: zod_1.z.string().describe("Nome do number range object (ex: MATERIALNR, RE_BELNR)."),
|
|
1062
|
+
}, async ({ object_name }) => {
|
|
1063
|
+
try {
|
|
1064
|
+
const result = await (0, number_range_js_1.abapNumberRange)({ object_name });
|
|
1065
|
+
return { content: [{ type: "text", text: result }] };
|
|
1066
|
+
}
|
|
1067
|
+
catch (error) {
|
|
1068
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1069
|
+
return { content: [{ type: "text", text: `Erro ao ler number range: ${message}` }], isError: true };
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
// Tool: abap_repository_tree
|
|
1073
|
+
server.tool("abap_repository_tree", "Navega a árvore de repositório SAP: software components, transport layers e pacotes.", {
|
|
1074
|
+
parent_node: zod_1.z.string().optional().describe("URI do nó pai. Se omitido, lista os nós raiz (software components)."),
|
|
1075
|
+
max_nodes: zod_1.z.number().optional().describe("Número máximo de nós retornados (padrão: 50)."),
|
|
1076
|
+
}, async ({ parent_node, max_nodes }) => {
|
|
1077
|
+
try {
|
|
1078
|
+
const result = await (0, repository_tree_js_1.abapRepositoryTree)({ parent_node, max_nodes });
|
|
1079
|
+
return { content: [{ type: "text", text: result }] };
|
|
1080
|
+
}
|
|
1081
|
+
catch (error) {
|
|
1082
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1083
|
+
return { content: [{ type: "text", text: `Erro na árvore de repositório: ${message}` }], isError: true };
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
// Tool: abap_discovery
|
|
1087
|
+
server.tool("abap_discovery", "Lista todas as APIs e tipos de objeto suportados pelo sistema SAP ADT. Útil para verificar quais funcionalidades estão disponíveis.", {}, async () => {
|
|
1088
|
+
try {
|
|
1089
|
+
const result = await (0, discovery_js_1.abapDiscovery)();
|
|
1090
|
+
return { content: [{ type: "text", text: result }] };
|
|
1091
|
+
}
|
|
1092
|
+
catch (error) {
|
|
1093
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1094
|
+
return { content: [{ type: "text", text: `Erro no discovery: ${message}` }], isError: true };
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
// Tool: abap_released_apis
|
|
1098
|
+
server.tool("abap_released_apis", "Lista APIs SAP released (contrato C1) disponíveis no sistema. Essencial para desenvolvimento BTP/Cloud ABAP.", {
|
|
1099
|
+
filter: zod_1.z.string().optional().describe("Filtro por nome da API (ex: 'CL_*SALES*', 'IF_*')."),
|
|
1100
|
+
api_type: zod_1.z
|
|
1101
|
+
.enum(["class", "interface", "cds", "all"])
|
|
1102
|
+
.optional()
|
|
1103
|
+
.describe("Tipo de API. Padrão: all."),
|
|
1104
|
+
}, async ({ filter, api_type }) => {
|
|
1105
|
+
try {
|
|
1106
|
+
const result = await (0, released_apis_js_1.abapReleasedApis)({ filter, api_type });
|
|
1107
|
+
return { content: [{ type: "text", text: result }] };
|
|
1108
|
+
}
|
|
1109
|
+
catch (error) {
|
|
1110
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1111
|
+
return { content: [{ type: "text", text: `Erro ao listar APIs released: ${message}` }], isError: true };
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
// Tool: abap_object_documentation
|
|
1115
|
+
server.tool("abap_object_documentation", "Lê a documentação técnica de um objeto SAP (classe, interface, function module, CDS, etc.).", {
|
|
1116
|
+
object_type: zod_1.z
|
|
1117
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI", "DDLS/DF", "TABL/DT", "DTEL/D", "DOMA/D"])
|
|
1118
|
+
.describe("Tipo do objeto."),
|
|
1119
|
+
object_name: zod_1.z.string().describe("Nome do objeto ABAP."),
|
|
1120
|
+
}, async ({ object_type, object_name }) => {
|
|
1121
|
+
try {
|
|
1122
|
+
const result = await (0, object_documentation_js_1.abapObjectDocumentation)({ object_type, object_name });
|
|
1123
|
+
return { content: [{ type: "text", text: result }] };
|
|
1124
|
+
}
|
|
1125
|
+
catch (error) {
|
|
1126
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1127
|
+
return { content: [{ type: "text", text: `Erro ao ler documentação: ${message}` }], isError: true };
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
// Tool: abap_git_repos
|
|
1131
|
+
server.tool("abap_git_repos", "Lista repositórios abapGit vinculados ao sistema SAP. Requer plugin abapGit instalado.", {}, async () => {
|
|
1132
|
+
try {
|
|
1133
|
+
const result = await (0, abapgit_js_1.abapGitRepos)();
|
|
1134
|
+
return { content: [{ type: "text", text: result }] };
|
|
1135
|
+
}
|
|
1136
|
+
catch (error) {
|
|
1137
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1138
|
+
return { content: [{ type: "text", text: `Erro ao listar repos abapGit: ${message}` }], isError: true };
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
// Tool: abap_git_pull
|
|
1142
|
+
server.tool("abap_git_pull", "Executa pull de um repositório abapGit no sistema SAP (importa código do Git para ABAP).", {
|
|
1143
|
+
repo_id: zod_1.z.string().describe("ID do repositório abapGit (obtido via abap_git_repos)."),
|
|
1144
|
+
branch: zod_1.z.string().optional().describe("Nome do branch (padrão: main)."),
|
|
1145
|
+
transport_request: zod_1.z.string().optional().describe("Ordem de transporte para os objetos importados."),
|
|
1146
|
+
}, async ({ repo_id, branch, transport_request }) => {
|
|
1147
|
+
try {
|
|
1148
|
+
const result = await (0, abapgit_js_1.abapGitPull)({ repo_id, branch, transport_request });
|
|
1149
|
+
return { content: [{ type: "text", text: result }] };
|
|
1150
|
+
}
|
|
1151
|
+
catch (error) {
|
|
1152
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1153
|
+
return { content: [{ type: "text", text: `Erro no pull abapGit: ${message}` }], isError: true };
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
// Tool: abap_git_stage
|
|
1157
|
+
server.tool("abap_git_stage", "Mostra status de staging e executa push para um repositório abapGit.", {
|
|
1158
|
+
repo_id: zod_1.z.string().describe("ID do repositório abapGit."),
|
|
1159
|
+
action: zod_1.z
|
|
1160
|
+
.enum(["status", "push"])
|
|
1161
|
+
.optional()
|
|
1162
|
+
.describe("Ação: 'status' (ver alterações) ou 'push' (enviar para Git). Padrão: status."),
|
|
1163
|
+
message: zod_1.z.string().optional().describe("Mensagem de commit (obrigatória para push)."),
|
|
1164
|
+
transport_request: zod_1.z.string().optional().describe("Ordem de transporte."),
|
|
1165
|
+
}, async ({ repo_id, action, message: commitMsg, transport_request }) => {
|
|
1166
|
+
try {
|
|
1167
|
+
const result = await (0, abapgit_js_1.abapGitStage)({ repo_id, action, message: commitMsg, transport_request });
|
|
1168
|
+
return { content: [{ type: "text", text: result }] };
|
|
1169
|
+
}
|
|
1170
|
+
catch (error) {
|
|
1171
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
1172
|
+
return { content: [{ type: "text", text: `Erro no stage abapGit: ${errMsg}` }], isError: true };
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
// Tool: abap_traces
|
|
1176
|
+
server.tool("abap_traces", "Lista e cria traces ABAP (SAT/runtime analysis) para análise de performance.", {
|
|
1177
|
+
action: zod_1.z.enum(["list", "create"]).optional().describe("Ação: 'list' (listar traces) ou 'create' (criar config). Padrão: list."),
|
|
1178
|
+
object_type: zod_1.z
|
|
1179
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI"])
|
|
1180
|
+
.optional()
|
|
1181
|
+
.describe("Tipo do objeto (obrigatório para create)."),
|
|
1182
|
+
object_name: zod_1.z.string().optional().describe("Nome do objeto (obrigatório para create)."),
|
|
1183
|
+
user: zod_1.z.string().optional().describe("Usuário SAP para o trace (opcional)."),
|
|
1184
|
+
}, async ({ action, object_type, object_name, user }) => {
|
|
1185
|
+
try {
|
|
1186
|
+
const result = await (0, traces_js_1.abapTraces)({ action, object_type, object_name, user });
|
|
1187
|
+
return { content: [{ type: "text", text: result }] };
|
|
1188
|
+
}
|
|
1189
|
+
catch (error) {
|
|
1190
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1191
|
+
return { content: [{ type: "text", text: `Erro nos traces: ${message}` }], isError: true };
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
// Tool: abap_breakpoints (experimental)
|
|
1195
|
+
server.tool("abap_breakpoints", "Gerencia breakpoints externos no sistema SAP (listar/criar/remover). Experimental: uso limitado via API.", {
|
|
1196
|
+
action: zod_1.z.enum(["list", "set", "remove"]).optional().describe("Ação: 'list', 'set' ou 'remove'. Padrão: list."),
|
|
1197
|
+
object_type: zod_1.z
|
|
1198
|
+
.enum(["PROG/P", "CLAS/OC", "FUGR/FF", "INTF/OI"])
|
|
1199
|
+
.optional()
|
|
1200
|
+
.describe("Tipo do objeto (obrigatório para set)."),
|
|
1201
|
+
object_name: zod_1.z.string().optional().describe("Nome do objeto (obrigatório para set)."),
|
|
1202
|
+
line: zod_1.z.number().optional().describe("Número da linha para o breakpoint (obrigatório para set)."),
|
|
1203
|
+
breakpoint_id: zod_1.z.string().optional().describe("ID do breakpoint a remover (obrigatório para remove)."),
|
|
1204
|
+
}, async ({ action, object_type, object_name, line, breakpoint_id }) => {
|
|
1205
|
+
try {
|
|
1206
|
+
const result = await (0, breakpoints_js_1.abapBreakpoints)({ action, object_type, object_name, line, breakpoint_id });
|
|
1207
|
+
return { content: [{ type: "text", text: result }] };
|
|
1208
|
+
}
|
|
1209
|
+
catch (error) {
|
|
1210
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1211
|
+
return { content: [{ type: "text", text: `Erro nos breakpoints: ${message}` }], isError: true };
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
// Tool: abap_create_dcl
|
|
1215
|
+
server.tool("abap_create_dcl", "Cria um objeto DCL (Data Control Language) para controle de acesso row-level em CDS views. " +
|
|
1216
|
+
"Gera o role definition com aspect pfcg_auth, aspect user ou condições literais. " +
|
|
1217
|
+
"DICA: consulte abap_knowledge(action:'get', topics:['abap-cds/access-control']) para padrões e auth objects comuns.", {
|
|
1218
|
+
dcl_name: zod_1.z.string().describe("Nome do DCL (ex: ZI_ORDER_DCL). Convenção: mesmo nome da CDS view + sufixo _DCL."),
|
|
1219
|
+
cds_entity: zod_1.z.string().describe("Nome da CDS view protegida (ex: ZI_ORDER)."),
|
|
1220
|
+
auth_type: zod_1.z
|
|
1221
|
+
.enum(["pfcg", "user", "literal", "combined"])
|
|
1222
|
+
.describe("Tipo de autorização: 'pfcg' (auth objects), 'user' (aspect user), 'literal' (condição fixa), 'combined' (múltiplas)."),
|
|
1223
|
+
auth_mappings: zod_1.z.array(zod_1.z.object({
|
|
1224
|
+
cds_fields: zod_1.z.array(zod_1.z.string()).describe("Campos CDS (ex: ['bukrs'] ou ['vkorg', 'vtweg', 'spart'])"),
|
|
1225
|
+
auth_object: zod_1.z.string().describe("Objeto de autorização SAP (ex: F_BKPF_BUK, V_VBAK_VKO)"),
|
|
1226
|
+
auth_fields: zod_1.z.array(zod_1.z.string()).describe("Campos do auth object (ex: ['BUKRS'] ou ['VKORG', 'VTWEG', 'SPART'])"),
|
|
1227
|
+
actvt: zod_1.z.string().optional().describe("Atividade (padrão: '03' = display)"),
|
|
1228
|
+
})).optional().describe("Mapeamentos PFCG — obrigatório para auth_type 'pfcg' e 'combined'."),
|
|
1229
|
+
literal_conditions: zod_1.z.array(zod_1.z.string()).optional()
|
|
1230
|
+
.describe("Condições literais (ex: [\"status <> 'DELETED'\", \"visibility = 'PUBLIC'\"])"),
|
|
1231
|
+
with_user_aspect: zod_1.z.boolean().optional()
|
|
1232
|
+
.describe("Adicionar 'created_by ?= aspect user' para filtrar por usuário criador."),
|
|
1233
|
+
package: zod_1.z.string().optional().describe("Pacote SAP. Padrão: '$TMP'."),
|
|
1234
|
+
transport_request: zod_1.z.string().optional().describe("Ordem de transporte."),
|
|
1235
|
+
}, async ({ dcl_name, cds_entity, auth_type, auth_mappings, literal_conditions, with_user_aspect, package: pkg, transport_request }) => {
|
|
1236
|
+
try {
|
|
1237
|
+
const result = await (0, create_dcl_js_1.abapCreateDcl)({ dcl_name, cds_entity, auth_type, auth_mappings, literal_conditions, with_user_aspect, package: pkg, transport_request });
|
|
1238
|
+
return { content: [{ type: "text", text: result }] };
|
|
1239
|
+
}
|
|
1240
|
+
catch (error) {
|
|
1241
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1242
|
+
return { content: [{ type: "text", text: `Erro ao criar DCL: ${message}` }], isError: true };
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
// Tool: abap_create_amdp
|
|
1246
|
+
server.tool("abap_create_amdp", "Cria uma classe AMDP (ABAP Managed Database Procedure) com boilerplate correto para SQLScript no HANA. " +
|
|
1247
|
+
"Suporta procedure (READ/WRITE) e table_function (para CDS Table Function). " +
|
|
1248
|
+
"DICA: consulte abap_knowledge(action:'get', topics:['abap/amdp']) para padrões e SQLScript.", {
|
|
1249
|
+
class_name: zod_1.z.string().describe("Nome da classe AMDP (ex: ZCL_AMDP_SALES_REPORT)."),
|
|
1250
|
+
method_name: zod_1.z.string().describe("Nome do método AMDP (ex: GET_SALES_DATA)."),
|
|
1251
|
+
method_type: zod_1.z.enum(["procedure", "table_function"])
|
|
1252
|
+
.describe("Tipo: 'procedure' (READ/WRITE via método) ou 'table_function' (usado com CDS Table Function)."),
|
|
1253
|
+
importing: zod_1.z.array(zod_1.z.object({
|
|
1254
|
+
name: zod_1.z.string().describe("Nome do parâmetro (ex: IV_BUKRS)"),
|
|
1255
|
+
type: zod_1.z.string().describe("Tipo ABAP (ex: bukrs, abap.char(4))"),
|
|
1256
|
+
})).optional().describe("Parâmetros de entrada do método."),
|
|
1257
|
+
exporting_table: zod_1.z.string().optional()
|
|
1258
|
+
.describe("Tipo da tabela de saída para procedure (ex: ZTT_SALES_DATA)."),
|
|
1259
|
+
cds_entity: zod_1.z.string().optional()
|
|
1260
|
+
.describe("CDS Table Function entity associada (obrigatório para table_function)."),
|
|
1261
|
+
description: zod_1.z.string().optional().describe("Descrição da classe."),
|
|
1262
|
+
package: zod_1.z.string().optional().describe("Pacote SAP. Padrão: '$TMP'."),
|
|
1263
|
+
transport_request: zod_1.z.string().optional().describe("Ordem de transporte."),
|
|
1264
|
+
}, async ({ class_name, method_name, method_type, importing: imp, exporting_table, cds_entity, description, package: pkg, transport_request }) => {
|
|
1265
|
+
try {
|
|
1266
|
+
const result = await (0, create_amdp_js_1.abapCreateAmdp)({ class_name, method_name, method_type, importing: imp, exporting_table, cds_entity, description, package: pkg, transport_request });
|
|
1267
|
+
return { content: [{ type: "text", text: result }] };
|
|
1268
|
+
}
|
|
1269
|
+
catch (error) {
|
|
1270
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1271
|
+
return { content: [{ type: "text", text: `Erro ao criar AMDP: ${message}` }], isError: true };
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
// Tool: abap_knowledge — BASE DE CONHECIMENTO (alma do produto)
|
|
1275
|
+
server.tool("abap_knowledge", "Base de conhecimento SAP com guias de referência sobre ABAP, CDS, RAP, Fiori e CAP. " +
|
|
1276
|
+
"IMPORTANTE: Consulte ANTES de criar ou modificar código ABAP/CDS/Fiori para garantir padrões corretos e evitar anti-patterns. " +
|
|
1277
|
+
"Ações: 'list' (ver tópicos disponíveis por domínio), 'get' (ler guias completos — máx 5 por vez), 'search' (buscar por palavra-chave). " +
|
|
1278
|
+
"Fluxo recomendado: search → identificar tópicos relevantes → get para ler o conteúdo completo.", {
|
|
1279
|
+
action: zod_1.z.enum(["list", "get", "search"])
|
|
1280
|
+
.describe("Ação: 'list' = catálogo de tópicos, 'get' = conteúdo completo, 'search' = busca por palavra-chave."),
|
|
1281
|
+
topics: zod_1.z.array(zod_1.z.string()).optional()
|
|
1282
|
+
.describe("IDs dos tópicos para ler (ação 'get'). Formato: 'domain/id' (ex: ['abap/rap-eml', 'abap/rap-draft']) ou apenas 'id' se único. Máximo 5."),
|
|
1283
|
+
query: zod_1.z.string().optional()
|
|
1284
|
+
.describe("Termo de busca (ação 'search'). Ex: 'draft', 'internal tables', 'annotations', 'BAPI'."),
|
|
1285
|
+
domain: zod_1.z.enum(["abap", "abap-cds", "fiori", "cap"]).optional()
|
|
1286
|
+
.describe("Filtrar por domínio. Opcional para 'list' e 'search'."),
|
|
1287
|
+
}, async ({ action, topics, query, domain }) => {
|
|
1288
|
+
try {
|
|
1289
|
+
const result = await (0, knowledge_js_1.abapKnowledge)({ action, topics, query, domain });
|
|
1290
|
+
return { content: [{ type: "text", text: result }] };
|
|
1291
|
+
}
|
|
1292
|
+
catch (error) {
|
|
1293
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1294
|
+
return { content: [{ type: "text", text: `Erro na base de conhecimento: ${message}` }], isError: true };
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1297
|
+
// Resource: system-profile
|
|
1298
|
+
server.resource("system-profile", "abap://system-profile", { description: "Perfil do sistema SAP conectado — tipo, capabilities, gateway, quirks. Presets disponíveis: " + (0, system_profile_js_1.listPresets)().join(", ") + ". Configurável via env SAP_SYSTEM_TYPE." }, async () => {
|
|
1299
|
+
const profile = (0, system_profile_js_1.getProfile)();
|
|
1300
|
+
return {
|
|
1301
|
+
contents: [{
|
|
1302
|
+
uri: "abap://system-profile",
|
|
1303
|
+
mimeType: "application/json",
|
|
1304
|
+
text: JSON.stringify(profile, null, 2),
|
|
1305
|
+
}],
|
|
1306
|
+
};
|
|
1307
|
+
});
|
|
1308
|
+
// Inicializa o servidor via stdio (modo Claude Code MCP)
|
|
1309
|
+
async function main() {
|
|
1310
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
1311
|
+
await server.connect(transport);
|
|
1312
|
+
const profile = (0, system_profile_js_1.getProfile)();
|
|
1313
|
+
process.stderr.write(`abap-mcp-server v2.0.0 iniciado | System: ${profile.system.type} | ABAP: ${profile.system.abapPlatform}\n`);
|
|
1314
|
+
}
|
|
1315
|
+
main().catch((err) => {
|
|
1316
|
+
process.stderr.write(`Falha ao iniciar servidor: ${err}\n`);
|
|
1317
|
+
process.exit(1);
|
|
1318
|
+
});
|