@mcpassure/mcp-anvisa-bulario 0.1.0 → 2.1.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.en.md +34 -8
- package/README.md +34 -8
- package/dist/bootstrap.d.ts +11 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +120 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/config.d.ts +10 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -12
- package/dist/config.js.map +1 -1
- package/dist/db/dataset.d.ts +15 -0
- package/dist/db/dataset.d.ts.map +1 -0
- package/dist/db/dataset.js +168 -0
- package/dist/db/dataset.js.map +1 -0
- package/dist/db/schema.d.ts +11 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +48 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/domain/repository.d.ts +11 -5
- package/dist/domain/repository.d.ts.map +1 -1
- package/dist/domain/repository.js +38 -58
- package/dist/domain/repository.js.map +1 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/schemas/tools.d.ts +4 -4
- package/dist/server.js +1 -1
- package/dist/tools/consultar-bula.d.ts +10 -0
- package/dist/tools/consultar-bula.d.ts.map +1 -1
- package/dist/tools/consultar-bula.js +41 -23
- package/dist/tools/consultar-bula.js.map +1 -1
- package/dist/tools/listar-apresentacoes.d.ts +7 -0
- package/dist/tools/listar-apresentacoes.d.ts.map +1 -1
- package/dist/tools/listar-apresentacoes.js +26 -8
- package/dist/tools/listar-apresentacoes.js.map +1 -1
- package/dist/tools/shared.d.ts +20 -11
- package/dist/tools/shared.d.ts.map +1 -1
- package/dist/tools/shared.js +50 -10
- package/dist/tools/shared.js.map +1 -1
- package/dist/utils/http.d.ts +12 -33
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +15 -167
- package/dist/utils/http.js.map +1 -1
- package/package.json +25 -23
- package/dist/utils/playwright-http.d.ts +0 -2
- package/dist/utils/playwright-http.d.ts.map +0 -1
- package/dist/utils/playwright-http.js +0 -4
- package/dist/utils/playwright-http.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/domain/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/domain/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,+BAA+B,EAC/B,kBAAkB,EAClB,4BAA4B,EAC5B,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,MAAM,IAAI,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,aAAa,GAAG,QAAQ,CAAC;IAC/B,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;gBAE/C,QAAQ,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;CAM9D;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IACzF,sBAAsB,CACpB,MAAM,EAAE,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1F,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAKhF,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAC;IAKhF,WAAW,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;CAIhF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_TTLS } from "../cache/types.js";
|
|
2
1
|
import { buildMeta } from "../utils/meta.js";
|
|
3
2
|
export class AllSourcesFailedError extends Error {
|
|
4
3
|
failures;
|
|
@@ -9,80 +8,61 @@ export class AllSourcesFailedError extends Error {
|
|
|
9
8
|
this.failures = failures;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* BularioRepository v2.0
|
|
13
|
+
*
|
|
14
|
+
* Accesses the ANVISA dataset directly via BularioDatasetSource (SQLite).
|
|
15
|
+
* The old multi-source + cache pattern is replaced by a single SQLite source.
|
|
16
|
+
* _meta.modo is always "cache_local" (data is pre-synced locally).
|
|
17
|
+
*/
|
|
12
18
|
export class BularioRepository {
|
|
13
|
-
|
|
14
|
-
sources;
|
|
19
|
+
source;
|
|
15
20
|
degradedThresholdDays;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.
|
|
21
|
+
dataBase;
|
|
22
|
+
constructor(source, degradedThresholdDays = 7) {
|
|
23
|
+
this.source = source;
|
|
19
24
|
this.degradedThresholdDays = degradedThresholdDays;
|
|
25
|
+
// Use current date as data_da_base — will be replaced by dataset_meta in a future version
|
|
26
|
+
this.dataBase = new Date().toISOString();
|
|
27
|
+
}
|
|
28
|
+
buildResponse(data) {
|
|
29
|
+
return {
|
|
30
|
+
data,
|
|
31
|
+
_meta: buildMeta({
|
|
32
|
+
dataBase: this.dataBase,
|
|
33
|
+
fonte: this.source.name,
|
|
34
|
+
modo: "cache_local",
|
|
35
|
+
degradedThresholdDays: this.degradedThresholdDays,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
20
38
|
}
|
|
21
39
|
async searchByName(params) {
|
|
22
|
-
const
|
|
23
|
-
return this.
|
|
40
|
+
const data = await this.source.searchByName(params);
|
|
41
|
+
return this.buildResponse(data);
|
|
24
42
|
}
|
|
25
43
|
async searchByPrincipalAtivo(params) {
|
|
26
|
-
const
|
|
27
|
-
return this.
|
|
44
|
+
const data = await this.source.searchByPrincipalAtivo(params);
|
|
45
|
+
return this.buildResponse(data);
|
|
28
46
|
}
|
|
29
47
|
async searchByClasseTerapeutica(params) {
|
|
30
|
-
const
|
|
31
|
-
return this.
|
|
48
|
+
const data = await this.source.searchByClasseTerapeutica(params);
|
|
49
|
+
return this.buildResponse(data);
|
|
32
50
|
}
|
|
33
51
|
async searchByTarja(params) {
|
|
34
|
-
const
|
|
35
|
-
return this.
|
|
52
|
+
const data = await this.source.searchByTarja(params);
|
|
53
|
+
return this.buildResponse(data);
|
|
36
54
|
}
|
|
37
55
|
async getDetalhes(numProcesso) {
|
|
38
|
-
const
|
|
39
|
-
return this.
|
|
56
|
+
const data = await this.source.getDetalhes(numProcesso);
|
|
57
|
+
return this.buildResponse(data);
|
|
40
58
|
}
|
|
41
59
|
async getApresentacoes(numProcesso) {
|
|
42
|
-
const
|
|
43
|
-
return this.
|
|
60
|
+
const data = await this.source.getApresentacoes(numProcesso);
|
|
61
|
+
return this.buildResponse(data);
|
|
44
62
|
}
|
|
45
63
|
async getBulaLink(idBulaProtegido) {
|
|
46
|
-
const
|
|
47
|
-
return this.
|
|
48
|
-
}
|
|
49
|
-
async _withCache(key, ttlSeconds, fetch) {
|
|
50
|
-
const cached = this.cache.get(key);
|
|
51
|
-
if (cached) {
|
|
52
|
-
return {
|
|
53
|
-
data: cached.value,
|
|
54
|
-
_meta: buildMeta({
|
|
55
|
-
dataBase: cached.data_da_base,
|
|
56
|
-
fonte: "cache_local",
|
|
57
|
-
modo: "cache_local",
|
|
58
|
-
degradedThresholdDays: this.degradedThresholdDays,
|
|
59
|
-
}),
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
const failures = [];
|
|
63
|
-
for (const source of this.sources) {
|
|
64
|
-
try {
|
|
65
|
-
const data = await fetch(source);
|
|
66
|
-
const dataBase = new Date().toISOString();
|
|
67
|
-
this.cache.set(key, data, ttlSeconds, dataBase);
|
|
68
|
-
return {
|
|
69
|
-
data,
|
|
70
|
-
_meta: buildMeta({
|
|
71
|
-
dataBase,
|
|
72
|
-
fonte: source.name,
|
|
73
|
-
modo: "online",
|
|
74
|
-
degradedThresholdDays: this.degradedThresholdDays,
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
failures.push({
|
|
80
|
-
source: source.name,
|
|
81
|
-
error: err instanceof Error ? err : new Error(String(err)),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
throw new AllSourcesFailedError(failures);
|
|
64
|
+
const data = await this.source.getBulaLink(idBulaProtegido);
|
|
65
|
+
return this.buildResponse(data);
|
|
86
66
|
}
|
|
87
67
|
}
|
|
88
68
|
//# sourceMappingURL=repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/domain/repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/domain/repository.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAe7C,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,QAAQ,CAA0C;IAE3D,YAAY,QAAiD;QAC3D,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,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AAyB,CAAC,MAAM,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,WAAmB;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,WAAmB;QACxC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,eAAuB;QACvC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ensureDataset, getDbPath } from "./bootstrap.js";
|
|
4
|
+
import { BularioDatasetSource } from "./db/dataset.js";
|
|
5
5
|
import { BularioRepository } from "./domain/repository.js";
|
|
6
6
|
import { createServer } from "./server.js";
|
|
7
|
-
import { AnvisaApiSource } from "./sources/anvisa-api.js";
|
|
8
7
|
async function main() {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
// Step 1: Ensure dataset is available (R2 bootstrap or local cache)
|
|
9
|
+
const bootstrapResult = await ensureDataset();
|
|
10
|
+
if (!bootstrapResult.ok) {
|
|
11
|
+
process.stderr.write(`[startup] ERRO: ${bootstrapResult.reason}\n` +
|
|
12
|
+
`Dica: Execute 'npm run sync' para popular o dataset local a partir do CSV da ANVISA.\n`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
process.stderr.write(`[startup] Dataset pronto (${bootstrapResult.action} v${bootstrapResult.version})\n`);
|
|
16
|
+
// Step 2: Open SQLite dataset
|
|
17
|
+
const dbPath = getDbPath();
|
|
18
|
+
const source = new BularioDatasetSource(dbPath);
|
|
19
|
+
const repository = new BularioRepository(source);
|
|
17
20
|
const server = createServer(repository);
|
|
18
21
|
const transport = new StdioServerTransport();
|
|
19
22
|
async function shutdown() {
|
|
20
|
-
|
|
21
|
-
await Promise.allSettled(sources.map((s) => s.close?.()));
|
|
22
|
-
cache.close();
|
|
23
|
+
await source.close();
|
|
23
24
|
process.exit(0);
|
|
24
25
|
}
|
|
25
26
|
process.on("SIGINT", () => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,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AAC,CAAC,GAAY,EAAE,EAAE;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/schemas/tools.d.ts
CHANGED
|
@@ -38,8 +38,8 @@ export declare const MetaSchema: z.ZodObject<{
|
|
|
38
38
|
online: "online";
|
|
39
39
|
}>;
|
|
40
40
|
status: z.ZodOptional<z.ZodEnum<{
|
|
41
|
-
stale: "stale";
|
|
42
41
|
ok: "ok";
|
|
42
|
+
stale: "stale";
|
|
43
43
|
}>>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
export declare const MedicamentoListaOutputSchema: z.ZodObject<{
|
|
@@ -64,8 +64,8 @@ export declare const MedicamentoListaOutputSchema: z.ZodObject<{
|
|
|
64
64
|
online: "online";
|
|
65
65
|
}>;
|
|
66
66
|
status: z.ZodOptional<z.ZodEnum<{
|
|
67
|
-
stale: "stale";
|
|
68
67
|
ok: "ok";
|
|
68
|
+
stale: "stale";
|
|
69
69
|
}>>;
|
|
70
70
|
}, z.core.$strip>;
|
|
71
71
|
}, z.core.$strip>;
|
|
@@ -99,8 +99,8 @@ export declare const BulaOutputSchema: z.ZodObject<{
|
|
|
99
99
|
online: "online";
|
|
100
100
|
}>;
|
|
101
101
|
status: z.ZodOptional<z.ZodEnum<{
|
|
102
|
-
stale: "stale";
|
|
103
102
|
ok: "ok";
|
|
103
|
+
stale: "stale";
|
|
104
104
|
}>>;
|
|
105
105
|
}, z.core.$strip>;
|
|
106
106
|
}, z.core.$strip>;
|
|
@@ -122,8 +122,8 @@ export declare const ApresentacoesOutputSchema: z.ZodObject<{
|
|
|
122
122
|
online: "online";
|
|
123
123
|
}>;
|
|
124
124
|
status: z.ZodOptional<z.ZodEnum<{
|
|
125
|
-
stale: "stale";
|
|
126
125
|
ok: "ok";
|
|
126
|
+
stale: "stale";
|
|
127
127
|
}>>;
|
|
128
128
|
}, z.core.$strip>;
|
|
129
129
|
}, z.core.$strip>;
|
package/dist/server.js
CHANGED
|
@@ -10,7 +10,7 @@ import { registerListarApresentacoes } from "./tools/listar-apresentacoes.js";
|
|
|
10
10
|
export function createServer(repository) {
|
|
11
11
|
const server = new McpServer({
|
|
12
12
|
name: "mcpassure-anvisa-bulario",
|
|
13
|
-
version: "
|
|
13
|
+
version: "2.0.0",
|
|
14
14
|
});
|
|
15
15
|
registerBuscarPorNome(server, repository);
|
|
16
16
|
registerBuscarPorPrincipioAtivo(server, repository);
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { IBularioRepository } from "../domain/repository.js";
|
|
3
|
+
/**
|
|
4
|
+
* consultar_bula — v2.0 limitation notice
|
|
5
|
+
*
|
|
6
|
+
* O texto completo de bula NÃO está disponível no CSV de dados abertos da ANVISA
|
|
7
|
+
* (DADOS_ABERTOS_MEDICAMENTOS.csv). Este endpoint retorna os metadados disponíveis
|
|
8
|
+
* do medicamento (classe terapêutica, princípio ativo, registro) e um aviso explicativo.
|
|
9
|
+
*
|
|
10
|
+
* O texto completo de bula está previsto para v2.1 via Worker Cloudflare que acessa
|
|
11
|
+
* a API bulario.anvisa.gov.br diretamente.
|
|
12
|
+
*/
|
|
3
13
|
export declare function registerConsultarBula(server: McpServer, repository: IBularioRepository): void;
|
|
4
14
|
//# sourceMappingURL=consultar-bula.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consultar-bula.d.ts","sourceRoot":"","sources":["../../src/tools/consultar-bula.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"consultar-bula.d.ts","sourceRoot":"","sources":["../../src/tools/consultar-bula.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAqD7F"}
|
|
@@ -1,38 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TOOL_ANNOTATIONS,
|
|
1
|
+
import { ConsultarBulaInputSchema } from "../schemas/tools.js";
|
|
2
|
+
import { TOOL_ANNOTATIONS, toErrorResult } from "./shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* consultar_bula — v2.0 limitation notice
|
|
5
|
+
*
|
|
6
|
+
* O texto completo de bula NÃO está disponível no CSV de dados abertos da ANVISA
|
|
7
|
+
* (DADOS_ABERTOS_MEDICAMENTOS.csv). Este endpoint retorna os metadados disponíveis
|
|
8
|
+
* do medicamento (classe terapêutica, princípio ativo, registro) e um aviso explicativo.
|
|
9
|
+
*
|
|
10
|
+
* O texto completo de bula está previsto para v2.1 via Worker Cloudflare que acessa
|
|
11
|
+
* a API bulario.anvisa.gov.br diretamente.
|
|
12
|
+
*/
|
|
3
13
|
export function registerConsultarBula(server, repository) {
|
|
4
14
|
server.registerTool("consultar_bula", {
|
|
5
15
|
title: "Consultar Bula de Medicamento",
|
|
6
|
-
description: "Retorna
|
|
7
|
-
"princípio ativo
|
|
16
|
+
description: "Retorna metadados disponíveis de um medicamento (classe terapêutica, " +
|
|
17
|
+
"princípio ativo, número de registro, situação). " +
|
|
18
|
+
"NOTA v2.0: O texto completo da bula e links PDF não estão disponíveis " +
|
|
19
|
+
"nesta versão (fonte CSV dados abertos ANVISA). " +
|
|
20
|
+
"Previsto para v2.1 via integração direta com bulario.anvisa.gov.br. " +
|
|
8
21
|
"Requer o numProcesso obtido via busca de medicamentos.",
|
|
9
22
|
inputSchema: ConsultarBulaInputSchema,
|
|
10
|
-
outputSchema: BulaOutputSchema,
|
|
11
23
|
annotations: TOOL_ANNOTATIONS,
|
|
12
24
|
}, async (args) => {
|
|
13
25
|
const { numProcesso } = args;
|
|
14
26
|
try {
|
|
15
27
|
const detalhesResult = await repository.getDetalhes(numProcesso);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
? (await repository.getBulaLink(detalhes.idBulaPacienteProtegido)).data
|
|
19
|
-
: undefined;
|
|
20
|
-
const bulaProfissional = detalhes.idBulaProfissionalProtegido
|
|
21
|
-
? (await repository.getBulaLink(detalhes.idBulaProfissionalProtegido)).data
|
|
22
|
-
: undefined;
|
|
23
|
-
return toBulaResult({
|
|
28
|
+
const det = detalhesResult.data;
|
|
29
|
+
const output = {
|
|
24
30
|
data: {
|
|
25
|
-
numProcesso:
|
|
26
|
-
nomeProduto:
|
|
27
|
-
empresa:
|
|
28
|
-
tarja:
|
|
29
|
-
classesTerapeuticas:
|
|
30
|
-
principioAtivo:
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
numProcesso: det.numProcesso,
|
|
32
|
+
nomeProduto: det.nomeProduto,
|
|
33
|
+
empresa: det.empresa,
|
|
34
|
+
tarja: det.tarja,
|
|
35
|
+
classesTerapeuticas: det.classesTerapeuticas,
|
|
36
|
+
principioAtivo: det.principioAtivo,
|
|
37
|
+
numeroRegistro: det.numeroRegistro,
|
|
38
|
+
bulaPaciente: null,
|
|
39
|
+
bulaProfissional: null,
|
|
40
|
+
aviso_v2: "Texto completo de bula não disponível nesta versão (v2.0). " +
|
|
41
|
+
"Fonte: CSV dados.anvisa.gov.br não inclui bulas PDF. " +
|
|
42
|
+
"Previsto: v2.1 via Worker com acesso ao bulario.anvisa.gov.br.",
|
|
33
43
|
},
|
|
34
|
-
_meta:
|
|
35
|
-
|
|
44
|
+
_meta: {
|
|
45
|
+
...detalhesResult._meta,
|
|
46
|
+
terminologia: "Bulário ANVISA",
|
|
47
|
+
fonte: "ANVISA / dados.anvisa.gov.br",
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
|
|
52
|
+
structuredContent: output,
|
|
53
|
+
};
|
|
36
54
|
}
|
|
37
55
|
catch (err) {
|
|
38
56
|
return toErrorResult(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consultar-bula.js","sourceRoot":"","sources":["../../src/tools/consultar-bula.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"consultar-bula.js","sourceRoot":"","sources":["../../src/tools/consultar-bula.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,UAA8B;IACrF,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,KAAK,EAAE,+BAA+B;QACtC,WAAW,EACT,uEAAuE;YACvE,kDAAkD;YAClD,wEAAwE;YACxE,iDAAiD;YACjD,sEAAsE;YACtE,wDAAwD;QAC1D,WAAW,EAAE,wBAAwB;QACrC,WAAW,EAAE,gBAAgB;KAC9B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YACjE,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC;YAEhC,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE;oBACJ,WAAW,EAAE,GAAG,CAAC,WAAW;oBAC5B,WAAW,EAAE,GAAG,CAAC,WAAW;oBAC5B,OAAO,EAAE,GAAG,CAAC,OAAO;oBACpB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;oBAC5C,cAAc,EAAE,GAAG,CAAC,cAAc;oBAClC,cAAc,EAAE,GAAG,CAAC,cAAc;oBAClC,YAAY,EAAE,IAAI;oBAClB,gBAAgB,EAAE,IAAI;oBACtB,QAAQ,EACN,6DAA6D;wBAC7D,uDAAuD;wBACvD,gEAAgE;iBACnE;gBACD,KAAK,EAAE;oBACL,GAAG,cAAc,CAAC,KAAK;oBACvB,YAAY,EAAE,gBAAgB;oBAC9B,KAAK,EAAE,8BAA8B;iBACtC;aACF,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC3E,iBAAiB,EAAE,MAAM;aAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { IBularioRepository } from "../domain/repository.js";
|
|
3
|
+
/**
|
|
4
|
+
* listar_apresentacoes — v2.0 limitation notice
|
|
5
|
+
*
|
|
6
|
+
* O CSV de dados abertos da ANVISA não contém campo de apresentações farmacêuticas
|
|
7
|
+
* (concentração, forma farmacêutica, embalagem). Retorna informações de categoria,
|
|
8
|
+
* situação e princípio ativo disponíveis no dataset.
|
|
9
|
+
*/
|
|
3
10
|
export declare function registerListarApresentacoes(server: McpServer, repository: IBularioRepository): void;
|
|
4
11
|
//# sourceMappingURL=listar-apresentacoes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listar-apresentacoes.d.ts","sourceRoot":"","sources":["../../src/tools/listar-apresentacoes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,kBAAkB,GAC7B,IAAI,
|
|
1
|
+
{"version":3,"file":"listar-apresentacoes.d.ts","sourceRoot":"","sources":["../../src/tools/listar-apresentacoes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,kBAAkB,GAC7B,IAAI,CAgDN"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TOOL_ANNOTATIONS,
|
|
1
|
+
import { ListarApresentacoesInputSchema } from "../schemas/tools.js";
|
|
2
|
+
import { TOOL_ANNOTATIONS, toErrorResult } from "./shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* listar_apresentacoes — v2.0 limitation notice
|
|
5
|
+
*
|
|
6
|
+
* O CSV de dados abertos da ANVISA não contém campo de apresentações farmacêuticas
|
|
7
|
+
* (concentração, forma farmacêutica, embalagem). Retorna informações de categoria,
|
|
8
|
+
* situação e princípio ativo disponíveis no dataset.
|
|
9
|
+
*/
|
|
3
10
|
export function registerListarApresentacoes(server, repository) {
|
|
4
11
|
server.registerTool("listar_apresentacoes", {
|
|
5
12
|
title: "Listar Apresentações de Medicamento",
|
|
6
|
-
description: "
|
|
7
|
-
"(
|
|
13
|
+
description: "Retorna informações disponíveis sobre um medicamento no dataset ANVISA dados abertos. " +
|
|
14
|
+
"NOTA v2.0: Apresentações farmacêuticas detalhadas (concentração, forma farmacêutica, " +
|
|
15
|
+
"embalagem) não estão disponíveis no CSV dados.anvisa.gov.br. " +
|
|
16
|
+
"Retorna categoria regulatória, situação de registro e princípio ativo. " +
|
|
8
17
|
"Requer o numProcesso obtido via busca de medicamentos.",
|
|
9
18
|
inputSchema: ListarApresentacoesInputSchema,
|
|
10
|
-
outputSchema: ApresentacoesOutputSchema,
|
|
11
19
|
annotations: TOOL_ANNOTATIONS,
|
|
12
20
|
}, async (args) => {
|
|
13
21
|
const { numProcesso } = args;
|
|
@@ -16,15 +24,25 @@ export function registerListarApresentacoes(server, repository) {
|
|
|
16
24
|
repository.getDetalhes(numProcesso),
|
|
17
25
|
repository.getApresentacoes(numProcesso),
|
|
18
26
|
]);
|
|
19
|
-
|
|
27
|
+
const output = {
|
|
20
28
|
data: {
|
|
21
29
|
numProcesso,
|
|
22
30
|
nomeProduto: detalhesResult.data.nomeProduto,
|
|
23
31
|
empresa: detalhesResult.data.empresa,
|
|
24
32
|
apresentacoes: apresentacoesResult.data,
|
|
33
|
+
aviso_v2: "Apresentações farmacêuticas detalhadas não disponíveis nesta versão (v2.0). " +
|
|
34
|
+
"Fonte: CSV dados.anvisa.gov.br não inclui concentração/forma farmacêutica/embalagem.",
|
|
25
35
|
},
|
|
26
|
-
_meta:
|
|
27
|
-
|
|
36
|
+
_meta: {
|
|
37
|
+
...detalhesResult._meta,
|
|
38
|
+
terminologia: "Bulário ANVISA",
|
|
39
|
+
fonte: "ANVISA / dados.anvisa.gov.br",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
|
|
44
|
+
structuredContent: output,
|
|
45
|
+
};
|
|
28
46
|
}
|
|
29
47
|
catch (err) {
|
|
30
48
|
return toErrorResult(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listar-apresentacoes.js","sourceRoot":"","sources":["../../src/tools/listar-apresentacoes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"listar-apresentacoes.js","sourceRoot":"","sources":["../../src/tools/listar-apresentacoes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAiB,EACjB,UAA8B;IAE9B,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,qCAAqC;QAC5C,WAAW,EACT,wFAAwF;YACxF,uFAAuF;YACvF,+DAA+D;YAC/D,yEAAyE;YACzE,wDAAwD;QAC1D,WAAW,EAAE,8BAA8B;QAC3C,WAAW,EAAE,gBAAgB;KAC9B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,CAAC,cAAc,EAAE,mBAAmB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC9D,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC;gBACnC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC;aACzC,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE;oBACJ,WAAW;oBACX,WAAW,EAAE,cAAc,CAAC,IAAI,CAAC,WAAW;oBAC5C,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO;oBACpC,aAAa,EAAE,mBAAmB,CAAC,IAAI;oBACvC,QAAQ,EACN,8EAA8E;wBAC9E,sFAAsF;iBACzF;gBACD,KAAK,EAAE;oBACL,GAAG,cAAc,CAAC,KAAK;oBACvB,YAAY,EAAE,gBAAgB;oBAC9B,KAAK,EAAE,8BAA8B;iBACtC;aACF,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC3E,iBAAiB,EAAE,MAAM;aAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/shared.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export declare const TOOL_ANNOTATIONS: {
|
|
|
3
3
|
readonly readOnlyHint: true;
|
|
4
4
|
readonly idempotentHint: true;
|
|
5
5
|
readonly destructiveHint: false;
|
|
6
|
-
readonly openWorldHint:
|
|
6
|
+
readonly openWorldHint: false;
|
|
7
7
|
};
|
|
8
|
-
export declare const DISCLAIMER
|
|
8
|
+
export declare const DISCLAIMER = "Dados informativos. N\u00E3o substitui consulta oficial ANVISA ou avalia\u00E7\u00E3o por profissional de sa\u00FAde habilitado.";
|
|
9
9
|
export declare function toListResult(output: MedicamentoListaOutput): {
|
|
10
10
|
content: {
|
|
11
11
|
type: "text";
|
|
@@ -25,12 +25,15 @@ export declare function toListResult(output: MedicamentoListaOutput): {
|
|
|
25
25
|
}[];
|
|
26
26
|
};
|
|
27
27
|
_meta: {
|
|
28
|
+
defasagem_dias: number;
|
|
29
|
+
status: "ok" | "stale";
|
|
30
|
+
terminologia: string;
|
|
31
|
+
versao: string;
|
|
28
32
|
data_da_base: string;
|
|
29
33
|
fonte: string;
|
|
30
|
-
|
|
31
|
-
modo: "cache_local" | "online";
|
|
32
|
-
status?: "stale" | "ok" | undefined;
|
|
34
|
+
modo: string;
|
|
33
35
|
};
|
|
36
|
+
disclaimer: string;
|
|
34
37
|
};
|
|
35
38
|
};
|
|
36
39
|
export declare function toBulaResult(output: BulaOutput): {
|
|
@@ -56,12 +59,15 @@ export declare function toBulaResult(output: BulaOutput): {
|
|
|
56
59
|
} | undefined;
|
|
57
60
|
};
|
|
58
61
|
_meta: {
|
|
62
|
+
defasagem_dias: number;
|
|
63
|
+
status: "ok" | "stale";
|
|
64
|
+
terminologia: string;
|
|
65
|
+
versao: string;
|
|
59
66
|
data_da_base: string;
|
|
60
67
|
fonte: string;
|
|
61
|
-
|
|
62
|
-
modo: "cache_local" | "online";
|
|
63
|
-
status?: "stale" | "ok" | undefined;
|
|
68
|
+
modo: string;
|
|
64
69
|
};
|
|
70
|
+
disclaimer: string;
|
|
65
71
|
};
|
|
66
72
|
};
|
|
67
73
|
export declare function toApresentacoesResult(output: ApresentacoesOutput): {
|
|
@@ -79,12 +85,15 @@ export declare function toApresentacoesResult(output: ApresentacoesOutput): {
|
|
|
79
85
|
}[];
|
|
80
86
|
};
|
|
81
87
|
_meta: {
|
|
88
|
+
defasagem_dias: number;
|
|
89
|
+
status: "ok" | "stale";
|
|
90
|
+
terminologia: string;
|
|
91
|
+
versao: string;
|
|
82
92
|
data_da_base: string;
|
|
83
93
|
fonte: string;
|
|
84
|
-
|
|
85
|
-
modo: "cache_local" | "online";
|
|
86
|
-
status?: "stale" | "ok" | undefined;
|
|
94
|
+
modo: string;
|
|
87
95
|
};
|
|
96
|
+
disclaimer: string;
|
|
88
97
|
};
|
|
89
98
|
};
|
|
90
99
|
export declare function toErrorResult(err: unknown): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnG,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEnG,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX,eAAO,MAAM,UAAU,qIACyF,CAAC;AAcjH,wBAAgB,YAAY,CAAC,MAAM,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe1D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe9C;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;EAehE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO;;;;;;EAMzC"}
|
package/dist/tools/shared.js
CHANGED
|
@@ -2,32 +2,72 @@ export const TOOL_ANNOTATIONS = {
|
|
|
2
2
|
readOnlyHint: true,
|
|
3
3
|
idempotentHint: true,
|
|
4
4
|
destructiveHint: false,
|
|
5
|
-
openWorldHint:
|
|
5
|
+
openWorldHint: false,
|
|
6
6
|
};
|
|
7
|
-
export const DISCLAIMER = "
|
|
8
|
-
|
|
7
|
+
export const DISCLAIMER = "Dados informativos. Não substitui consulta oficial ANVISA ou avaliação por profissional de saúde habilitado.";
|
|
8
|
+
function buildMeta(data_da_base) {
|
|
9
|
+
return {
|
|
10
|
+
terminologia: "Bulário ANVISA",
|
|
11
|
+
versao: "20260515",
|
|
12
|
+
data_da_base,
|
|
13
|
+
fonte: "ANVISA / dados.anvisa.gov.br",
|
|
14
|
+
defasagem_dias: 0,
|
|
15
|
+
modo: "cache_local",
|
|
16
|
+
status: "ok",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
9
19
|
export function toListResult(output) {
|
|
20
|
+
const meta = buildMeta(output._meta.data_da_base);
|
|
21
|
+
const structuredContent = {
|
|
22
|
+
data: output.data,
|
|
23
|
+
_meta: {
|
|
24
|
+
...meta,
|
|
25
|
+
defasagem_dias: output._meta.defasagem_dias,
|
|
26
|
+
status: output._meta.status ?? "ok",
|
|
27
|
+
},
|
|
28
|
+
disclaimer: DISCLAIMER,
|
|
29
|
+
};
|
|
10
30
|
return {
|
|
11
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
12
|
-
structuredContent
|
|
31
|
+
content: [{ type: "text", text: JSON.stringify(structuredContent, null, 2) }],
|
|
32
|
+
structuredContent,
|
|
13
33
|
};
|
|
14
34
|
}
|
|
15
35
|
export function toBulaResult(output) {
|
|
36
|
+
const meta = buildMeta(output._meta.data_da_base);
|
|
37
|
+
const structuredContent = {
|
|
38
|
+
data: output.data,
|
|
39
|
+
_meta: {
|
|
40
|
+
...meta,
|
|
41
|
+
defasagem_dias: output._meta.defasagem_dias,
|
|
42
|
+
status: output._meta.status ?? "ok",
|
|
43
|
+
},
|
|
44
|
+
disclaimer: DISCLAIMER,
|
|
45
|
+
};
|
|
16
46
|
return {
|
|
17
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
18
|
-
structuredContent
|
|
47
|
+
content: [{ type: "text", text: JSON.stringify(structuredContent, null, 2) }],
|
|
48
|
+
structuredContent,
|
|
19
49
|
};
|
|
20
50
|
}
|
|
21
51
|
export function toApresentacoesResult(output) {
|
|
52
|
+
const meta = buildMeta(output._meta.data_da_base);
|
|
53
|
+
const structuredContent = {
|
|
54
|
+
data: output.data,
|
|
55
|
+
_meta: {
|
|
56
|
+
...meta,
|
|
57
|
+
defasagem_dias: output._meta.defasagem_dias,
|
|
58
|
+
status: output._meta.status ?? "ok",
|
|
59
|
+
},
|
|
60
|
+
disclaimer: DISCLAIMER,
|
|
61
|
+
};
|
|
22
62
|
return {
|
|
23
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
24
|
-
structuredContent
|
|
63
|
+
content: [{ type: "text", text: JSON.stringify(structuredContent, null, 2) }],
|
|
64
|
+
structuredContent,
|
|
25
65
|
};
|
|
26
66
|
}
|
|
27
67
|
export function toErrorResult(err) {
|
|
28
68
|
const message = err instanceof Error ? err.message : String(err);
|
|
29
69
|
return {
|
|
30
|
-
content: [{ type: "text", text: `Erro ao consultar ANVISA: ${message}` }],
|
|
70
|
+
content: [{ type: "text", text: `Erro ao consultar base ANVISA: ${message}` }],
|
|
31
71
|
isError: true,
|
|
32
72
|
};
|
|
33
73
|
}
|