bling-docs-mcp 1.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/LICENSE +21 -0
- package/README.md +281 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +275 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/embeddings.d.ts +18 -0
- package/dist/lib/embeddings.d.ts.map +1 -0
- package/dist/lib/embeddings.js +52 -0
- package/dist/lib/embeddings.js.map +1 -0
- package/dist/lib/indexer.d.ts +13 -0
- package/dist/lib/indexer.d.ts.map +1 -0
- package/dist/lib/indexer.js +305 -0
- package/dist/lib/indexer.js.map +1 -0
- package/dist/lib/loader.d.ts +34 -0
- package/dist/lib/loader.d.ts.map +1 -0
- package/dist/lib/loader.js +267 -0
- package/dist/lib/loader.js.map +1 -0
- package/dist/lib/openapi-tools.d.ts +38 -0
- package/dist/lib/openapi-tools.d.ts.map +1 -0
- package/dist/lib/openapi-tools.js +63 -0
- package/dist/lib/openapi-tools.js.map +1 -0
- package/dist/lib/schema-resolver.d.ts +17 -0
- package/dist/lib/schema-resolver.d.ts.map +1 -0
- package/dist/lib/schema-resolver.js +173 -0
- package/dist/lib/schema-resolver.js.map +1 -0
- package/dist/lib/types.d.ts +207 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/vector-store.d.ts +46 -0
- package/dist/lib/vector-store.d.ts.map +1 -0
- package/dist/lib/vector-store.js +66 -0
- package/dist/lib/vector-store.js.map +1 -0
- package/dist/scripts/compare-extraction.d.ts +7 -0
- package/dist/scripts/compare-extraction.d.ts.map +1 -0
- package/dist/scripts/compare-extraction.js +223 -0
- package/dist/scripts/compare-extraction.js.map +1 -0
- package/dist/scripts/compare-with-docs-site.d.ts +7 -0
- package/dist/scripts/compare-with-docs-site.d.ts.map +1 -0
- package/dist/scripts/compare-with-docs-site.js +264 -0
- package/dist/scripts/compare-with-docs-site.js.map +1 -0
- package/dist/scripts/field-coverage-report.d.ts +14 -0
- package/dist/scripts/field-coverage-report.d.ts.map +1 -0
- package/dist/scripts/field-coverage-report.js +352 -0
- package/dist/scripts/field-coverage-report.js.map +1 -0
- package/dist/scripts/final-coverage-report.d.ts +1 -0
- package/dist/scripts/final-coverage-report.d.ts.map +1 -0
- package/dist/scripts/final-coverage-report.js +2 -0
- package/dist/scripts/final-coverage-report.js.map +1 -0
- package/dist/scripts/inspect-endpoint.d.ts +15 -0
- package/dist/scripts/inspect-endpoint.d.ts.map +1 -0
- package/dist/scripts/inspect-endpoint.js +292 -0
- package/dist/scripts/inspect-endpoint.js.map +1 -0
- package/dist/scripts/performance-validation.d.ts +10 -0
- package/dist/scripts/performance-validation.d.ts.map +1 -0
- package/dist/scripts/performance-validation.js +123 -0
- package/dist/scripts/performance-validation.js.map +1 -0
- package/dist/scripts/test-all.d.ts +7 -0
- package/dist/scripts/test-all.d.ts.map +1 -0
- package/dist/scripts/test-all.js +76 -0
- package/dist/scripts/test-all.js.map +1 -0
- package/dist/scripts/test-new-fields.d.ts +6 -0
- package/dist/scripts/test-new-fields.d.ts.map +1 -0
- package/dist/scripts/test-new-fields.js +243 -0
- package/dist/scripts/test-new-fields.js.map +1 -0
- package/dist/scripts/test-schema-fields.d.ts +7 -0
- package/dist/scripts/test-schema-fields.d.ts.map +1 -0
- package/dist/scripts/test-schema-fields.js +198 -0
- package/dist/scripts/test-schema-fields.js.map +1 -0
- package/dist/scripts/validate-extraction.d.ts +15 -0
- package/dist/scripts/validate-extraction.d.ts.map +1 -0
- package/dist/scripts/validate-extraction.js +294 -0
- package/dist/scripts/validate-extraction.js.map +1 -0
- package/dist/scripts/validate-full-extraction.d.ts +6 -0
- package/dist/scripts/validate-full-extraction.d.ts.map +1 -0
- package/dist/scripts/validate-full-extraction.js +399 -0
- package/dist/scripts/validate-full-extraction.js.map +1 -0
- package/dist/scripts/validate-phase1-fields.d.ts +6 -0
- package/dist/scripts/validate-phase1-fields.d.ts.map +1 -0
- package/dist/scripts/validate-phase1-fields.js +162 -0
- package/dist/scripts/validate-phase1-fields.js.map +1 -0
- package/dist/scripts/validate-phase2-fields.d.ts +6 -0
- package/dist/scripts/validate-phase2-fields.d.ts.map +1 -0
- package/dist/scripts/validate-phase2-fields.js +127 -0
- package/dist/scripts/validate-phase2-fields.js.map +1 -0
- package/dist/scripts/validate-phase3-fields.d.ts +6 -0
- package/dist/scripts/validate-phase3-fields.d.ts.map +1 -0
- package/dist/scripts/validate-phase3-fields.js +106 -0
- package/dist/scripts/validate-phase3-fields.js.map +1 -0
- package/dist/tools/compare-with-openapi-spec.d.ts +10 -0
- package/dist/tools/compare-with-openapi-spec.d.ts.map +1 -0
- package/dist/tools/compare-with-openapi-spec.js +266 -0
- package/dist/tools/compare-with-openapi-spec.js.map +1 -0
- package/dist/tools/compare-with-postman.d.ts +25 -0
- package/dist/tools/compare-with-postman.d.ts.map +1 -0
- package/dist/tools/compare-with-postman.js +257 -0
- package/dist/tools/compare-with-postman.js.map +1 -0
- package/dist/tools/describe.d.ts +39 -0
- package/dist/tools/describe.d.ts.map +1 -0
- package/dist/tools/describe.js +64 -0
- package/dist/tools/describe.js.map +1 -0
- package/dist/tools/get-auth-info.d.ts +33 -0
- package/dist/tools/get-auth-info.d.ts.map +1 -0
- package/dist/tools/get-auth-info.js +27 -0
- package/dist/tools/get-auth-info.js.map +1 -0
- package/dist/tools/get-endpoint-details.d.ts +27 -0
- package/dist/tools/get-endpoint-details.d.ts.map +1 -0
- package/dist/tools/get-endpoint-details.js +59 -0
- package/dist/tools/get-endpoint-details.js.map +1 -0
- package/dist/tools/get-schema.d.ts +34 -0
- package/dist/tools/get-schema.d.ts.map +1 -0
- package/dist/tools/get-schema.js +64 -0
- package/dist/tools/get-schema.js.map +1 -0
- package/dist/tools/list-tags.d.ts +29 -0
- package/dist/tools/list-tags.d.ts.map +1 -0
- package/dist/tools/list-tags.js +23 -0
- package/dist/tools/list-tags.js.map +1 -0
- package/dist/tools/read-documentation-page.d.ts +23 -0
- package/dist/tools/read-documentation-page.d.ts.map +1 -0
- package/dist/tools/read-documentation-page.js +73 -0
- package/dist/tools/read-documentation-page.js.map +1 -0
- package/dist/tools/search-documentation.d.ts +26 -0
- package/dist/tools/search-documentation.d.ts.map +1 -0
- package/dist/tools/search-documentation.js +91 -0
- package/dist/tools/search-documentation.js.map +1 -0
- package/dist/tools/search-endpoints.d.ts +35 -0
- package/dist/tools/search-endpoints.d.ts.map +1 -0
- package/dist/tools/search-endpoints.js +120 -0
- package/dist/tools/search-endpoints.js.map +1 -0
- package/dist/tools/search-schemas.d.ts +30 -0
- package/dist/tools/search-schemas.d.ts.map +1 -0
- package/dist/tools/search-schemas.js +36 -0
- package/dist/tools/search-schemas.js.map +1 -0
- package/dist/tools/validate-spec.d.ts +44 -0
- package/dist/tools/validate-spec.d.ts.map +1 -0
- package/dist/tools/validate-spec.js +186 -0
- package/dist/tools/validate-spec.js.map +1 -0
- package/docs/ajuda_como_gerar_o_access_token.md +8 -0
- package/docs/ajuda_como_gerar_o_client_id_e_o_client_secret.md +8 -0
- package/docs/ajuda_full.md +35 -0
- package/docs/ajuda_preciso_criar_uma_conta_no_bling_para_utilizar_a_api.md +9 -0
- package/docs/ajuda_quais_sao_os_limites_da_api.md +9 -0
- package/docs/ajuda_qual_e_a_utilidade_do_campo_state.md +9 -0
- package/docs/ajuda_qual_e_o_formato_de_retorno_das_respostas_da_api.md +18 -0
- package/docs/ajuda_quantos_registros_sao_retornados_por_pagina_em_cada_requisicao.md +9 -0
- package/docs/aplicativos_acesso_ao_modulo.md +12 -0
- package/docs/aplicativos_como_cadastrar.md +258 -0
- package/docs/aplicativos_full.md +276 -0
- package/docs/aplicativos_gerenciamento.md +9 -0
- package/docs/aplicativos_inscricao.md +8 -0
- package/docs/aplicativos_introducao.md +8 -0
- package/docs/changelogs-webhooks_2026.md +88 -0
- package/docs/changelogs-webhooks_full.md +90 -0
- package/docs/changelogs_2026.md +88 -0
- package/docs/changelogs_full.md +90 -0
- package/docs/guias_como_utilizar_os_tokens.md +20 -0
- package/docs/guias_full.md +72 -0
- package/docs/guias_fundamentos.md +11 -0
- package/docs/guias_introducao.md +9 -0
- package/docs/guias_o_que_e_api.md +10 -0
- package/docs/guias_oauth_e_tokens_de_acesso.md +9 -0
- package/docs/guias_padrao_rest.md +34 -0
- package/docs/guias_para_quem_e_destinada_a_api.md +9 -0
- package/docs/guias_sobre_o_bling.md +9 -0
- package/docs/limites_filtros.md +9 -0
- package/docs/limites_full.md +56 -0
- package/docs/limites_requisicoes.md +50 -0
- package/docs/migracao-jwt_estrutura_e_tamanho_do_token.md +9 -0
- package/docs/migracao-jwt_full.md +107 -0
- package/docs/migracao-jwt_ganhos_computacionais_e_de_infraestrutura.md +11 -0
- package/docs/migracao-jwt_introducao.md +15 -0
- package/docs/migracao-jwt_motivacao_da_alteracao.md +9 -0
- package/docs/migracao-jwt_tratamento_de_erros_comuns.md +13 -0
- package/docs/migracao-jwt_utilizando_jwt_no_bling.md +74 -0
- package/docs/publicando_full.md +118 -0
- package/docs/publicando_processo.md +9 -0
- package/docs/publicando_revisao.md +86 -0
- package/docs/publicando_situacoes.md +16 -0
- package/docs/publicando_validacao_de_dados.md +23 -0
- package/docs/webhooks_acoes.md +12 -0
- package/docs/webhooks_autenticacao.md +22 -0
- package/docs/webhooks_como_cadastrar.md +20 -0
- package/docs/webhooks_entrega_nao_ordenada.md +9 -0
- package/docs/webhooks_full.md +453 -0
- package/docs/webhooks_idempotencia.md +9 -0
- package/docs/webhooks_introducao.md +9 -0
- package/docs/webhooks_recebimento_de_eventos.md +8 -0
- package/docs/webhooks_recursos.md +374 -0
- package/docs/webhooks_retentativas.md +9 -0
- package/docs/webhooks_webhooks_vs_polling.md +13 -0
- package/package.json +67 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare with Postman Tool
|
|
3
|
+
* Compares our indexed data with what Postman would see
|
|
4
|
+
* to ensure we're extracting the same information
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Compare our extraction with raw OpenAPI data
|
|
8
|
+
* This simulates what Postman would see vs what we extract
|
|
9
|
+
*/
|
|
10
|
+
export function compareWithPostman(input, indexedData, spec) {
|
|
11
|
+
const differences = [];
|
|
12
|
+
const matches = [];
|
|
13
|
+
const recommendations = [];
|
|
14
|
+
// If no sample endpoint provided, use first one
|
|
15
|
+
let sampleEndpoint = input.sampleEndpoint;
|
|
16
|
+
if (!sampleEndpoint && indexedData.endpoints.length > 0) {
|
|
17
|
+
const first = indexedData.endpoints[0];
|
|
18
|
+
sampleEndpoint = `${first.method} ${first.path}`;
|
|
19
|
+
}
|
|
20
|
+
if (!sampleEndpoint) {
|
|
21
|
+
return {
|
|
22
|
+
comparison: {
|
|
23
|
+
ourExtraction: null,
|
|
24
|
+
rawOpenAPIData: null,
|
|
25
|
+
differences: ['No endpoints available'],
|
|
26
|
+
matches: []
|
|
27
|
+
},
|
|
28
|
+
recommendations: ['Load OpenAPI spec first']
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Parse endpoint
|
|
32
|
+
const [method, path] = sampleEndpoint.split(' ', 2);
|
|
33
|
+
const methodLower = method.toLowerCase();
|
|
34
|
+
// Get our extraction
|
|
35
|
+
const key = `${method.toUpperCase()} ${path}`;
|
|
36
|
+
const ourData = indexedData.endpointsByPath.get(key);
|
|
37
|
+
if (!ourData) {
|
|
38
|
+
return {
|
|
39
|
+
comparison: {
|
|
40
|
+
ourExtraction: null,
|
|
41
|
+
rawOpenAPIData: null,
|
|
42
|
+
differences: [`Endpoint not found in our index: ${sampleEndpoint}`],
|
|
43
|
+
matches: []
|
|
44
|
+
},
|
|
45
|
+
recommendations: ['Check if endpoint exists in OpenAPI spec']
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Get raw OpenAPI data
|
|
49
|
+
const pathItem = spec.paths[path];
|
|
50
|
+
const operation = pathItem?.[methodLower];
|
|
51
|
+
if (!operation) {
|
|
52
|
+
return {
|
|
53
|
+
comparison: {
|
|
54
|
+
ourExtraction: ourData,
|
|
55
|
+
rawOpenAPIData: null,
|
|
56
|
+
differences: [`Endpoint not found in OpenAPI spec: ${sampleEndpoint}`],
|
|
57
|
+
matches: []
|
|
58
|
+
},
|
|
59
|
+
recommendations: ['This is a bug - endpoint in index but not in spec']
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Compare fields
|
|
63
|
+
// 1. Summary
|
|
64
|
+
if (ourData.summary === operation.summary) {
|
|
65
|
+
matches.push('✓ Summary matches');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
differences.push(`✗ Summary differs: "${ourData.summary}" vs "${operation.summary}"`);
|
|
69
|
+
}
|
|
70
|
+
// 2. Description
|
|
71
|
+
if (ourData.description === (operation.description || '')) {
|
|
72
|
+
matches.push('✓ Description matches');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
differences.push(`✗ Description differs`);
|
|
76
|
+
}
|
|
77
|
+
// 3. Tags
|
|
78
|
+
const specTags = operation.tags || [];
|
|
79
|
+
if (JSON.stringify(ourData.tags.sort()) === JSON.stringify(specTags.sort())) {
|
|
80
|
+
matches.push('✓ Tags match');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
differences.push(`✗ Tags differ: [${ourData.tags.join(', ')}] vs [${specTags.join(', ')}]`);
|
|
84
|
+
}
|
|
85
|
+
// 4. Parameters
|
|
86
|
+
const specParams = [
|
|
87
|
+
...(pathItem?.parameters || []),
|
|
88
|
+
...(operation.parameters || [])
|
|
89
|
+
].filter(p => p && !('$ref' in p));
|
|
90
|
+
if (ourData.parameters.length === specParams.length) {
|
|
91
|
+
matches.push(`✓ Parameter count matches (${specParams.length})`);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
differences.push(`✗ Parameter count differs: ${ourData.parameters.length} vs ${specParams.length}`);
|
|
95
|
+
recommendations.push('Check parameter extraction logic');
|
|
96
|
+
}
|
|
97
|
+
// Check each parameter
|
|
98
|
+
for (const specParam of specParams) {
|
|
99
|
+
const ourParam = ourData.parameters.find(p => p.name === specParam.name);
|
|
100
|
+
if (!ourParam) {
|
|
101
|
+
differences.push(`✗ Missing parameter: ${specParam.name}`);
|
|
102
|
+
recommendations.push(`Add parameter extraction for: ${specParam.name}`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Check parameter fields
|
|
106
|
+
if (ourParam.in === specParam.in) {
|
|
107
|
+
matches.push(`✓ Parameter "${specParam.name}" location matches (${specParam.in})`);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
differences.push(`✗ Parameter "${specParam.name}" location differs: ${ourParam.in} vs ${specParam.in}`);
|
|
111
|
+
}
|
|
112
|
+
if (ourParam.required === (specParam.required || false)) {
|
|
113
|
+
matches.push(`✓ Parameter "${specParam.name}" required matches`);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
differences.push(`✗ Parameter "${specParam.name}" required differs`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// 5. Request Body
|
|
121
|
+
const hasRequestBody = operation.requestBody !== undefined;
|
|
122
|
+
const weHaveRequestBody = ourData.requestBody !== undefined;
|
|
123
|
+
if (hasRequestBody === weHaveRequestBody) {
|
|
124
|
+
matches.push(`✓ Request body presence matches (${hasRequestBody})`);
|
|
125
|
+
if (hasRequestBody && ourData.requestBody) {
|
|
126
|
+
const specBody = operation.requestBody;
|
|
127
|
+
const specRequired = specBody.required || false;
|
|
128
|
+
if (ourData.requestBody.required === specRequired) {
|
|
129
|
+
matches.push('✓ Request body required matches');
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
differences.push(`✗ Request body required differs: ${ourData.requestBody.required} vs ${specRequired}`);
|
|
133
|
+
}
|
|
134
|
+
// Check content type
|
|
135
|
+
const specContentTypes = Object.keys(specBody.content || {});
|
|
136
|
+
if (specContentTypes.includes(ourData.requestBody.contentType)) {
|
|
137
|
+
matches.push(`✓ Request body content type matches (${ourData.requestBody.contentType})`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
differences.push(`✗ Request body content type differs: ${ourData.requestBody.contentType} vs [${specContentTypes.join(', ')}]`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
differences.push(`✗ Request body presence differs: we have ${weHaveRequestBody}, spec has ${hasRequestBody}`);
|
|
146
|
+
recommendations.push('Check request body extraction logic');
|
|
147
|
+
}
|
|
148
|
+
// 6. Responses
|
|
149
|
+
const specResponses = Object.keys(operation.responses || {});
|
|
150
|
+
const ourResponses = ourData.responses.map(r => r.statusCode);
|
|
151
|
+
if (ourResponses.length === specResponses.length) {
|
|
152
|
+
matches.push(`✓ Response count matches (${specResponses.length})`);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
differences.push(`✗ Response count differs: ${ourResponses.length} vs ${specResponses.length}`);
|
|
156
|
+
}
|
|
157
|
+
// Check each response
|
|
158
|
+
for (const statusCode of specResponses) {
|
|
159
|
+
const ourResponse = ourData.responses.find(r => r.statusCode === statusCode);
|
|
160
|
+
if (!ourResponse) {
|
|
161
|
+
differences.push(`✗ Missing response: ${statusCode}`);
|
|
162
|
+
recommendations.push(`Add response extraction for status: ${statusCode}`);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
matches.push(`✓ Response ${statusCode} present`);
|
|
166
|
+
const specResponse = operation.responses[statusCode];
|
|
167
|
+
if (ourResponse.description === (specResponse.description || '')) {
|
|
168
|
+
matches.push(`✓ Response ${statusCode} description matches`);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
differences.push(`✗ Response ${statusCode} description differs`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// 7. Security
|
|
176
|
+
const specSecurity = operation.security || [];
|
|
177
|
+
const hasSecurity = specSecurity.length > 0;
|
|
178
|
+
const weHaveSecurity = ourData.security !== undefined;
|
|
179
|
+
if (hasSecurity === weHaveSecurity) {
|
|
180
|
+
matches.push(`✓ Security presence matches (${hasSecurity})`);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
differences.push(`✗ Security presence differs: we have ${weHaveSecurity}, spec has ${hasSecurity}`);
|
|
184
|
+
}
|
|
185
|
+
// Generate recommendations
|
|
186
|
+
if (differences.length === 0) {
|
|
187
|
+
recommendations.push('✓ Perfect match! Our extraction is complete and accurate.');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
recommendations.push(`Found ${differences.length} differences. Review extraction logic.`);
|
|
191
|
+
}
|
|
192
|
+
if (matches.length > differences.length) {
|
|
193
|
+
recommendations.push(`Good coverage: ${matches.length} matches vs ${differences.length} differences`);
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
comparison: {
|
|
197
|
+
ourExtraction: {
|
|
198
|
+
path: ourData.path,
|
|
199
|
+
method: ourData.method,
|
|
200
|
+
summary: ourData.summary,
|
|
201
|
+
description: ourData.description,
|
|
202
|
+
tags: ourData.tags,
|
|
203
|
+
parameterCount: ourData.parameters.length,
|
|
204
|
+
parameters: ourData.parameters.map(p => ({
|
|
205
|
+
name: p.name,
|
|
206
|
+
in: p.in,
|
|
207
|
+
required: p.required,
|
|
208
|
+
type: p.type
|
|
209
|
+
})),
|
|
210
|
+
hasRequestBody: ourData.requestBody !== undefined,
|
|
211
|
+
requestBody: ourData.requestBody ? {
|
|
212
|
+
required: ourData.requestBody.required,
|
|
213
|
+
contentType: ourData.requestBody.contentType
|
|
214
|
+
} : null,
|
|
215
|
+
responseCount: ourData.responses.length,
|
|
216
|
+
responses: ourData.responses.map(r => ({
|
|
217
|
+
statusCode: r.statusCode,
|
|
218
|
+
description: r.description,
|
|
219
|
+
hasSchema: r.schema !== undefined
|
|
220
|
+
})),
|
|
221
|
+
hasSecurity: ourData.security !== undefined,
|
|
222
|
+
security: ourData.security
|
|
223
|
+
},
|
|
224
|
+
rawOpenAPIData: {
|
|
225
|
+
path,
|
|
226
|
+
method: methodLower,
|
|
227
|
+
summary: operation.summary,
|
|
228
|
+
description: operation.description,
|
|
229
|
+
tags: operation.tags,
|
|
230
|
+
parameterCount: specParams.length,
|
|
231
|
+
parameters: specParams.map((p) => ({
|
|
232
|
+
name: p.name,
|
|
233
|
+
in: p.in,
|
|
234
|
+
required: p.required,
|
|
235
|
+
schema: p.schema
|
|
236
|
+
})),
|
|
237
|
+
hasRequestBody: operation.requestBody !== undefined,
|
|
238
|
+
requestBody: operation.requestBody ? {
|
|
239
|
+
required: operation.requestBody.required,
|
|
240
|
+
contentTypes: Object.keys(operation.requestBody.content || {})
|
|
241
|
+
} : null,
|
|
242
|
+
responseCount: specResponses.length,
|
|
243
|
+
responses: specResponses.map(code => ({
|
|
244
|
+
statusCode: code,
|
|
245
|
+
description: operation.responses[code].description,
|
|
246
|
+
hasContent: operation.responses[code].content !== undefined
|
|
247
|
+
})),
|
|
248
|
+
hasSecurity: specSecurity.length > 0,
|
|
249
|
+
security: specSecurity
|
|
250
|
+
},
|
|
251
|
+
differences,
|
|
252
|
+
matches
|
|
253
|
+
},
|
|
254
|
+
recommendations
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=compare-with-postman.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare-with-postman.js","sourceRoot":"","sources":["../../src/tools/compare-with-postman.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAA8B,EAC9B,WAAwB,EACxB,IAAiB;IAEjB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,eAAe,GAAa,EAAE,CAAC;IAErC,gDAAgD;IAChD,IAAI,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;IAC1C,IAAI,CAA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,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describe Tool
|
|
3
|
+
* Returns a complete overview of the API — ideal as the FIRST call
|
|
4
|
+
* to orient the LLM about what the API offers
|
|
5
|
+
*/
|
|
6
|
+
import type { IndexedData } from '../lib/types.js';
|
|
7
|
+
import type { OpenAPISpec } from '../lib/loader.js';
|
|
8
|
+
export interface DescribeOutput {
|
|
9
|
+
api: {
|
|
10
|
+
title: string;
|
|
11
|
+
version: string;
|
|
12
|
+
description: string;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
docsUrl?: string;
|
|
15
|
+
};
|
|
16
|
+
authentication: {
|
|
17
|
+
type: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
flows?: any;
|
|
20
|
+
scopes?: Record<string, string>;
|
|
21
|
+
}[];
|
|
22
|
+
modules: {
|
|
23
|
+
name: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
endpointCount: number;
|
|
26
|
+
}[];
|
|
27
|
+
totalEndpoints: number;
|
|
28
|
+
totalSchemas: number;
|
|
29
|
+
commonParameters?: {
|
|
30
|
+
name: string;
|
|
31
|
+
in: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
required: boolean;
|
|
34
|
+
type: string;
|
|
35
|
+
}[];
|
|
36
|
+
usage: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function describe(indexedData: IndexedData, spec: OpenAPISpec): DescribeOutput;
|
|
39
|
+
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/tools/describe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE;QACH,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC,EAAE,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;KACvB,EAAE,CAAC;IACJ,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACJ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,QAAQ,CACtB,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,WAAW,GAChB,cAAc,CA2DhB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describe Tool
|
|
3
|
+
* Returns a complete overview of the API — ideal as the FIRST call
|
|
4
|
+
* to orient the LLM about what the API offers
|
|
5
|
+
*/
|
|
6
|
+
export function describe(indexedData, spec) {
|
|
7
|
+
// Build authentication info
|
|
8
|
+
const authentication = indexedData.securitySchemes.map(s => {
|
|
9
|
+
const scopes = {};
|
|
10
|
+
if (s.flows) {
|
|
11
|
+
const flow = s.flows.authorizationCode || s.flows.clientCredentials || s.flows.implicit;
|
|
12
|
+
if (flow?.scopes)
|
|
13
|
+
Object.assign(scopes, flow.scopes);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
type: s.type,
|
|
17
|
+
description: s.description,
|
|
18
|
+
flows: s.flows,
|
|
19
|
+
scopes: Object.keys(scopes).length > 0 ? scopes : undefined,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
// Common parameters from components/parameters
|
|
23
|
+
const commonParameters = [];
|
|
24
|
+
const compParams = spec.components?.parameters;
|
|
25
|
+
if (compParams) {
|
|
26
|
+
for (const [, param] of Object.entries(compParams)) {
|
|
27
|
+
const p = param;
|
|
28
|
+
commonParameters.push({
|
|
29
|
+
name: p.name,
|
|
30
|
+
in: p.in,
|
|
31
|
+
description: p.description,
|
|
32
|
+
required: p.required === true,
|
|
33
|
+
type: p.schema?.type || 'string',
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const usage = `USAGE GUIDE:
|
|
38
|
+
1. Call 'search_endpoints' to find endpoints by natural language query or filter by tag/method
|
|
39
|
+
2. Call 'get_endpoint_details' with path+method to get full parameters, request body, and response schemas
|
|
40
|
+
3. Call 'get_schema' without arguments to list all schemas, or with 'ref' to get a specific schema with example
|
|
41
|
+
4. Call 'read_documentation_page' to read guides, webhooks docs, limits, changelogs, FAQs, etc.
|
|
42
|
+
5. Call 'search_documentation' for full-text search across all documentation pages
|
|
43
|
+
6. This 'describe' tool gives you the overall picture — call it once at the start`;
|
|
44
|
+
return {
|
|
45
|
+
api: {
|
|
46
|
+
title: spec.info?.title || 'Bling API',
|
|
47
|
+
version: spec.info?.version || '',
|
|
48
|
+
description: spec.info?.description || '',
|
|
49
|
+
baseUrl: indexedData.baseUrl,
|
|
50
|
+
docsUrl: spec.info?.['x-docs-url'] || spec.externalDocs?.url,
|
|
51
|
+
},
|
|
52
|
+
authentication,
|
|
53
|
+
modules: indexedData.tags.map(t => ({
|
|
54
|
+
name: t.name,
|
|
55
|
+
description: t.description,
|
|
56
|
+
endpointCount: t.endpointCount,
|
|
57
|
+
})),
|
|
58
|
+
totalEndpoints: indexedData.endpoints.length,
|
|
59
|
+
totalSchemas: indexedData.schemas.size,
|
|
60
|
+
commonParameters: commonParameters.length > 0 ? commonParameters : undefined,
|
|
61
|
+
usage,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/tools/describe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH,MAAM,UAAU,QAAQ,CACtB,WAAwB,EACxB,IAAiB;IAEjB,4BAA4B;IAC5B,MAAM,cAAc,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACzD,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxF,IAAI,IAAI,EAAE,MAAM;gBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC;QACD,OAAO;YACL,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SAC5D,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,+CAA+C;IAC/C,MAAM,gBAAgB,GAAuC,EAAE,CAAC;IAChE,MAAM,UAAU,GAAI,IAAY,CAAC,UAAU,EAAE,UAAU,CAAC;IACxD,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,MAAM,CA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C5E,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Auth Info Tool
|
|
3
|
+
* Returns authentication information including security schemes and base URL
|
|
4
|
+
*/
|
|
5
|
+
import type { IndexedData } from '../lib/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Input parameters for get_auth_info tool
|
|
8
|
+
*/
|
|
9
|
+
export interface GetAuthInfoInput {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Output format for get_auth_info tool
|
|
13
|
+
*/
|
|
14
|
+
export interface GetAuthInfoOutput {
|
|
15
|
+
securitySchemes: {
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
scheme?: string;
|
|
20
|
+
bearerFormat?: string;
|
|
21
|
+
in?: string;
|
|
22
|
+
flows?: any;
|
|
23
|
+
}[];
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get authentication information from the API spec
|
|
28
|
+
* @param input - Empty input (no parameters needed)
|
|
29
|
+
* @param indexedData - Indexed OpenAPI data
|
|
30
|
+
* @returns Authentication information including security schemes and base URL
|
|
31
|
+
*/
|
|
32
|
+
export declare function getAuthInfo(input: GetAuthInfoInput, indexedData: IndexedData): GetAuthInfoOutput;
|
|
33
|
+
//# sourceMappingURL=get-auth-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-auth-info.d.ts","sourceRoot":"","sources":["../../src/tools/get-auth-info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,iBAAiB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;CAEhC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,GAAG,CAAC;KACb,EAAE,CAAC;IACJ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,WAAW,GACvB,iBAAiB,CAgBnB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Auth Info Tool
|
|
3
|
+
* Returns authentication information including security schemes and base URL
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get authentication information from the API spec
|
|
7
|
+
* @param input - Empty input (no parameters needed)
|
|
8
|
+
* @param indexedData - Indexed OpenAPI data
|
|
9
|
+
* @returns Authentication information including security schemes and base URL
|
|
10
|
+
*/
|
|
11
|
+
export function getAuthInfo(input, indexedData) {
|
|
12
|
+
// Map security schemes to output format
|
|
13
|
+
const securitySchemes = indexedData.securitySchemes.map(scheme => ({
|
|
14
|
+
name: scheme.name,
|
|
15
|
+
type: scheme.type,
|
|
16
|
+
description: scheme.description,
|
|
17
|
+
scheme: scheme.scheme,
|
|
18
|
+
bearerFormat: scheme.bearerFormat,
|
|
19
|
+
in: scheme.in,
|
|
20
|
+
flows: scheme.flows,
|
|
21
|
+
}));
|
|
22
|
+
return {
|
|
23
|
+
securitySchemes,
|
|
24
|
+
baseUrl: indexedData.baseUrl,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=get-auth-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-auth-info.js","sourceRoot":"","sources":["../../src/tools/get-auth-info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,KAAuB,EACvB,WAAwB;IAExB,wCAAwC;IACxC,MAAM,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjE,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,eAAe;QACf,OAAO,EAAE,WAAW,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Endpoint Details Tool
|
|
3
|
+
* Returns complete details for a specific API endpoint including
|
|
4
|
+
* auto-generated request body example via openapi-sampler
|
|
5
|
+
*/
|
|
6
|
+
import type { IndexedData, RequestBodyInfo } from '../lib/types.js';
|
|
7
|
+
import type { OpenAPISpec } from '../lib/loader.js';
|
|
8
|
+
export interface GetEndpointDetailsInput {
|
|
9
|
+
path: string;
|
|
10
|
+
method: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getEndpointDetails(input: GetEndpointDetailsInput, indexedData: IndexedData, spec: OpenAPISpec): {
|
|
13
|
+
path: string;
|
|
14
|
+
method: string;
|
|
15
|
+
operationId: string | undefined;
|
|
16
|
+
summary: string;
|
|
17
|
+
description: string;
|
|
18
|
+
tags: string[];
|
|
19
|
+
deprecated: true | undefined;
|
|
20
|
+
security: string[] | undefined;
|
|
21
|
+
parameters: import("../lib/types.js").ParameterInfo[];
|
|
22
|
+
requestBody: (RequestBodyInfo & {
|
|
23
|
+
example?: any;
|
|
24
|
+
}) | undefined;
|
|
25
|
+
responses: import("../lib/types.js").ResponseInfo[];
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=get-endpoint-details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-endpoint-details.d.ts","sourceRoot":"","sources":["../../src/tools/get-endpoint-details.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,EAC9B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,WAAW;;;;;;;;;;;kBAWuC,GAAG;;;EA0C5D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Endpoint Details Tool
|
|
3
|
+
* Returns complete details for a specific API endpoint including
|
|
4
|
+
* auto-generated request body example via openapi-sampler
|
|
5
|
+
*/
|
|
6
|
+
import { resolveSchema } from '../lib/schema-resolver.js';
|
|
7
|
+
// @ts-ignore — openapi-sampler has no complete types
|
|
8
|
+
import openapiSampler from 'openapi-sampler';
|
|
9
|
+
export function getEndpointDetails(input, indexedData, spec) {
|
|
10
|
+
const methodUpper = input.method.toUpperCase();
|
|
11
|
+
const key = `${methodUpper} ${input.path}`;
|
|
12
|
+
const endpoint = indexedData.endpointsByPath.get(key);
|
|
13
|
+
if (!endpoint) {
|
|
14
|
+
throw new Error(`Endpoint not found: ${methodUpper} ${input.path}. Use search_endpoints to find valid paths.`);
|
|
15
|
+
}
|
|
16
|
+
// Resolve request body schema
|
|
17
|
+
let resolvedRequestBody;
|
|
18
|
+
if (endpoint.requestBody) {
|
|
19
|
+
const resolvedSchema = resolveSchema(endpoint.requestBody.schema, spec);
|
|
20
|
+
let example;
|
|
21
|
+
try {
|
|
22
|
+
example = openapiSampler.sample(endpoint.requestBody.schema, {}, spec);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// ignore — example generation is best-effort
|
|
26
|
+
}
|
|
27
|
+
resolvedRequestBody = {
|
|
28
|
+
required: endpoint.requestBody.required,
|
|
29
|
+
contentType: endpoint.requestBody.contentType,
|
|
30
|
+
schema: resolvedSchema,
|
|
31
|
+
description: endpoint.requestBody.description,
|
|
32
|
+
...(example !== undefined && { example }),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Resolve response schemas
|
|
36
|
+
const resolvedResponses = endpoint.responses.map(response => {
|
|
37
|
+
if (response.schema) {
|
|
38
|
+
return {
|
|
39
|
+
...response,
|
|
40
|
+
schema: resolveSchema(response.schema, spec),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return response;
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
path: endpoint.path,
|
|
47
|
+
method: endpoint.method,
|
|
48
|
+
operationId: endpoint.operationId,
|
|
49
|
+
summary: endpoint.summary,
|
|
50
|
+
description: endpoint.description,
|
|
51
|
+
tags: endpoint.tags,
|
|
52
|
+
deprecated: endpoint.deprecated || undefined,
|
|
53
|
+
security: endpoint.security,
|
|
54
|
+
parameters: endpoint.parameters,
|
|
55
|
+
requestBody: resolvedRequestBody,
|
|
56
|
+
responses: resolvedResponses,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=get-endpoint-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-endpoint-details.js","sourceRoot":"","sources":["../../src/tools/get-endpoint-details.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,qDAAqD;AACrD,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAO7C,MAAM,UAAU,kBAAkB,CAChC,KAA8B,EAC9B,WAAwB,EACxB,IAAiB;IA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QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,SAAS;QAC5C,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,WAAW,EAAE,mBAAmB;QAChC,SAAS,EAAE,iBAAiB;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Schema Tool — Dual Mode
|
|
3
|
+
* - Without 'ref': lists all schemas (names + types + brief description)
|
|
4
|
+
* - With 'ref': returns full resolved schema + auto-generated JSON example
|
|
5
|
+
*/
|
|
6
|
+
import type { IndexedData } from '../lib/types.js';
|
|
7
|
+
import type { OpenAPISpec } from '../lib/loader.js';
|
|
8
|
+
export interface GetSchemaInput {
|
|
9
|
+
ref?: string;
|
|
10
|
+
filter?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getSchema(input: GetSchemaInput, indexedData: IndexedData, spec: OpenAPISpec): {
|
|
13
|
+
mode: "list";
|
|
14
|
+
schemas: {
|
|
15
|
+
name: string;
|
|
16
|
+
type: any;
|
|
17
|
+
description: any;
|
|
18
|
+
}[];
|
|
19
|
+
total: number;
|
|
20
|
+
hint: string;
|
|
21
|
+
} | {
|
|
22
|
+
example?: any;
|
|
23
|
+
mode: "detail";
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
description: string | undefined;
|
|
27
|
+
properties: import("../lib/types.js").PropertyInfo[] | undefined;
|
|
28
|
+
required: string[] | undefined;
|
|
29
|
+
enum: any[] | undefined;
|
|
30
|
+
schemas?: undefined;
|
|
31
|
+
total?: undefined;
|
|
32
|
+
hint?: undefined;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=get-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-schema.d.ts","sourceRoot":"","sources":["../../src/tools/get-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;EA+DlB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Schema Tool — Dual Mode
|
|
3
|
+
* - Without 'ref': lists all schemas (names + types + brief description)
|
|
4
|
+
* - With 'ref': returns full resolved schema + auto-generated JSON example
|
|
5
|
+
*/
|
|
6
|
+
import { resolveSchema } from '../lib/schema-resolver.js';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import openapiSampler from 'openapi-sampler';
|
|
9
|
+
export function getSchema(input, indexedData, spec) {
|
|
10
|
+
// --- LIST MODE: no ref provided ---
|
|
11
|
+
if (!input.ref) {
|
|
12
|
+
let schemas = [...indexedData.schemas.entries()];
|
|
13
|
+
if (input.filter) {
|
|
14
|
+
const f = input.filter.toLowerCase();
|
|
15
|
+
schemas = schemas.filter(([name, s]) => name.toLowerCase().includes(f) ||
|
|
16
|
+
(s.description || '').toLowerCase().includes(f));
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
mode: 'list',
|
|
20
|
+
schemas: schemas.map(([name, schema]) => ({
|
|
21
|
+
name,
|
|
22
|
+
type: schema.type || 'object',
|
|
23
|
+
description: schema.description,
|
|
24
|
+
})),
|
|
25
|
+
total: schemas.length,
|
|
26
|
+
hint: 'Use get_schema with { "ref": "SchemaName" } to get full details and an example for a specific schema.',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
// --- DETAIL MODE: resolve the specific schema ---
|
|
30
|
+
// Support both a plain name ("ProdutoDTO") and $ref paths (#/components/schemas/ProdutoDTO)
|
|
31
|
+
const refClean = input.ref.replace(/^#\/components\/schemas\//, '');
|
|
32
|
+
const rawSchema = indexedData.schemas.get(refClean);
|
|
33
|
+
if (!rawSchema) {
|
|
34
|
+
// Try case-insensitive match
|
|
35
|
+
const lower = refClean.toLowerCase();
|
|
36
|
+
const match = [...indexedData.schemas.keys()].find(k => k.toLowerCase() === lower);
|
|
37
|
+
if (!match) {
|
|
38
|
+
const names = [...indexedData.schemas.keys()].slice(0, 20).join(', ');
|
|
39
|
+
throw new Error(`Schema not found: "${input.ref}". Available schemas (first 20): ${names}`);
|
|
40
|
+
}
|
|
41
|
+
// Recurse with corrected casing
|
|
42
|
+
return getSchema({ ref: match, filter: input.filter }, indexedData, spec);
|
|
43
|
+
}
|
|
44
|
+
const resolved = resolveSchema(rawSchema, spec);
|
|
45
|
+
// Generate example
|
|
46
|
+
let example;
|
|
47
|
+
try {
|
|
48
|
+
example = openapiSampler.sample(rawSchema, {}, spec);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// best-effort
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
mode: 'detail',
|
|
55
|
+
name: refClean,
|
|
56
|
+
type: resolved.type,
|
|
57
|
+
description: resolved.description,
|
|
58
|
+
properties: resolved.properties,
|
|
59
|
+
required: resolved.required,
|
|
60
|
+
enum: resolved.enum,
|
|
61
|
+
...(example !== undefined && { example }),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=get-schema.js.map
|