@zincapp/mcp-server 1.4.0 → 1.5.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/dist/tools/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { registerGetEndpoint } from './get-endpoint.js';
|
|
|
6
6
|
import { registerSandboxRequest } from './sandbox-request.js';
|
|
7
7
|
import { registerGetContract } from './get-contract.js';
|
|
8
8
|
import { registerAuditRetiradas } from './audit-retiradas.js';
|
|
9
|
+
import { registerListRetiradas } from './list-retiradas.js';
|
|
9
10
|
import { registerGetRetiradaAudit } from './get-retirada-audit.js';
|
|
10
11
|
import { registerProposeCompletion } from './propose-completion.js';
|
|
11
12
|
import { registerAuditEntities } from './audit-entities.js';
|
|
@@ -21,6 +22,7 @@ export function registerAllTools(server, client) {
|
|
|
21
22
|
registerSandboxRequest(server, client);
|
|
22
23
|
registerGetContract(server, client);
|
|
23
24
|
registerAuditRetiradas(server, client);
|
|
25
|
+
registerListRetiradas(server, client);
|
|
24
26
|
registerGetRetiradaAudit(server, client);
|
|
25
27
|
registerProposeCompletion(server, client);
|
|
26
28
|
registerAuditEntities(server, client);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { resolveElevation } from './elevation.js';
|
|
3
|
+
const DIMENSIONS = [
|
|
4
|
+
'transportista', 'autorizacion-transportista', 'nt', 'kgDi', 'residuo',
|
|
5
|
+
'rd-origen', 'rd-final', 'gestor-nima', 'autorizacion-gestor', 'direccion-gestor', 'documentos',
|
|
6
|
+
];
|
|
7
|
+
export function registerListRetiradas(server, client) {
|
|
8
|
+
server.tool('list_retiradas', 'Enumerate a year\'s waste removals that FAIL (or match) ONE audit dimension — the missing ' +
|
|
9
|
+
'complement to audit_retiradas, which only ranks the worst removals by TOTAL gap count (so a ' +
|
|
10
|
+
'removal whose only gap is e.g. a missing transportista never surfaces). Use this to walk the ' +
|
|
11
|
+
'full population for a single dimension and triage it. Each row is light: removalId, label, ' +
|
|
12
|
+
'hasNt (LOAD-BEARING — a missing transportista is inherited from the NT, so hasNt=false means ' +
|
|
13
|
+
'the real fix is the NT, not the transportista), and otherGapCount (how many OTHER dimensions ' +
|
|
14
|
+
'also fail, so you can pick the clean single-gap ones). Paginated. Read-only, no AI. Runs ' +
|
|
15
|
+
'under your active operator elevation — the company is the one you elevated into (no companyId).', {
|
|
16
|
+
year: z.number().describe('Calendar year, e.g. 2025'),
|
|
17
|
+
dimension: z.enum(DIMENSIONS).describe('Which audit dimension to filter on'),
|
|
18
|
+
status: z.enum(['missing', 'mismatch', 'ok']).optional()
|
|
19
|
+
.describe('Which status to match for that dimension (default: missing)'),
|
|
20
|
+
offset: z.number().optional().describe('Page offset into the matching set (default 0)'),
|
|
21
|
+
limit: z.number().optional().describe('Page size (default 50, max 200)'),
|
|
22
|
+
}, async ({ year, dimension, status, offset, limit }) => {
|
|
23
|
+
const elev = await resolveElevation(client);
|
|
24
|
+
if ('content' in elev)
|
|
25
|
+
return elev;
|
|
26
|
+
const params = { year: String(year), dimension };
|
|
27
|
+
if (status)
|
|
28
|
+
params.status = status;
|
|
29
|
+
if (offset != null)
|
|
30
|
+
params.offset = String(offset);
|
|
31
|
+
if (limit != null)
|
|
32
|
+
params.limit = String(limit);
|
|
33
|
+
const r = await client.get('/mwm/retirada/list', params);
|
|
34
|
+
const st = r.status;
|
|
35
|
+
if (r.total === 0) {
|
|
36
|
+
return { content: [{ type: 'text', text: `Ninguna retirada con ${r.dimension}:${st} en ${year} (escaneadas ${r.scanned}).` }] };
|
|
37
|
+
}
|
|
38
|
+
const shown = r.items.length;
|
|
39
|
+
const pageEnd = r.offset + shown;
|
|
40
|
+
const withNt = r.items.filter(i => i.hasNt).length;
|
|
41
|
+
const cleanest = r.items.filter(i => i.otherGapCount === 0).length;
|
|
42
|
+
const lines = r.items.map(i => `- **${i.removalId}** ${i.label}` +
|
|
43
|
+
` · NT: ${i.hasNt ? 'sí' : 'NO'}` +
|
|
44
|
+
` · otros gaps: ${i.otherGapCount}`).join('\n');
|
|
45
|
+
const capNote = r.scanCapped
|
|
46
|
+
? `\n\n⚠️ El escaneo llegó al límite (${r.scanned}); pueden existir más retiradas sin evaluar.`
|
|
47
|
+
: '';
|
|
48
|
+
const pageNote = r.total > pageEnd
|
|
49
|
+
? `\n\n_Mostrando ${r.offset + 1}–${pageEnd} de ${r.total}. Siguiente página: offset=${pageEnd}._`
|
|
50
|
+
: `\n\n_Mostrando ${r.offset + 1}–${pageEnd} de ${r.total} (última página)._`;
|
|
51
|
+
const summary = `# Retiradas con ${r.dimension}:${st} · ${year}\n` +
|
|
52
|
+
`**${r.total}** en total · en esta página: ${withNt} con NT, ${cleanest} sin otros gaps.\n\n` +
|
|
53
|
+
lines + pageNote + capNote;
|
|
54
|
+
return { content: [{ type: 'text', text: summary }] };
|
|
55
|
+
});
|
|
56
|
+
}
|
package/package.json
CHANGED