autoform-mcp-server 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { handleGenerateBatch, generateBatchSchema } from './tools/generateBatch.
|
|
|
13
13
|
import { handleListTemplates, listTemplatesSchema } from './tools/manageTemplates.js';
|
|
14
14
|
import { handleImportTemplate, importTemplateSchema } from './tools/importTemplate.js';
|
|
15
15
|
import { withMetrics } from './services/metricsLogger.js';
|
|
16
|
-
const server = new Server({ name: 'autoform', version: '1.7.
|
|
16
|
+
const server = new Server({ name: 'autoform', version: '1.7.1' }, { capabilities: { tools: {} } });
|
|
17
17
|
// Register all tools
|
|
18
18
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
19
19
|
tools: [
|
|
@@ -100,6 +100,14 @@ export async function handleFillAtCoordinates(args) {
|
|
|
100
100
|
isError: true
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
// Validate PDF exists
|
|
104
|
+
const fs = await import('fs');
|
|
105
|
+
if (!fs.existsSync(pdf_path)) {
|
|
106
|
+
return { content: [{ type: 'text', text: JSON.stringify({
|
|
107
|
+
error: true,
|
|
108
|
+
message: `El archivo PDF NO existe en la ruta: "${pdf_path}". Verifica que la ruta sea correcta.`
|
|
109
|
+
}, null, 2) }], isError: true };
|
|
110
|
+
}
|
|
103
111
|
const outputFile = output_path || path.join(path.dirname(pdf_path), `${path.basename(pdf_path, '.pdf')}_filled_${Date.now()}.pdf`);
|
|
104
112
|
const filled = await PdfService.fillAtCoordinates(pdf_path, fields, outputFile);
|
|
105
113
|
return {
|
|
@@ -87,6 +87,14 @@ export async function handleFillBatchAcroForm(args) {
|
|
|
87
87
|
isError: true
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
+
// Validate PDF exists BEFORE attempting batch generation
|
|
91
|
+
const fs = await import('fs');
|
|
92
|
+
if (!fs.existsSync(pdf_path)) {
|
|
93
|
+
return { content: [{ type: 'text', text: JSON.stringify({
|
|
94
|
+
error: true,
|
|
95
|
+
message: `El archivo PDF NO existe en la ruta: "${pdf_path}". Verifica que la ruta sea correcta.`
|
|
96
|
+
}, null, 2) }], isError: true };
|
|
97
|
+
}
|
|
90
98
|
const outDir = output_dir || path.dirname(pdf_path);
|
|
91
99
|
const baseName = path.basename(pdf_path, '.pdf').replace(/[^a-zA-Z0-9_\-]/g, '_');
|
|
92
100
|
const result = await PdfService.batchFillAcroForm(pdf_path, data_rows, outDir, baseName, merge_into_single, field_map);
|
|
@@ -111,6 +111,14 @@ export async function handleFillBatchAtCoordinates(args) {
|
|
|
111
111
|
if (!data_rows || !Array.isArray(data_rows) || data_rows.length === 0) {
|
|
112
112
|
return { content: [{ type: 'text', text: JSON.stringify({ error: true, message: 'data_rows es requerido (array de objetos con datos)' }, null, 2) }], isError: true };
|
|
113
113
|
}
|
|
114
|
+
// Validate PDF exists BEFORE attempting batch generation
|
|
115
|
+
const fs = await import('fs');
|
|
116
|
+
if (!fs.existsSync(pdf_path)) {
|
|
117
|
+
return { content: [{ type: 'text', text: JSON.stringify({
|
|
118
|
+
error: true,
|
|
119
|
+
message: `El archivo PDF NO existe en la ruta: "${pdf_path}". Verifica que la ruta sea correcta. Si el usuario te dio un nombre de archivo, usa el filesystem MCP para verificar que existe antes de llamar esta tool.`
|
|
120
|
+
}, null, 2) }], isError: true };
|
|
121
|
+
}
|
|
114
122
|
const outDir = output_dir || path.dirname(pdf_path);
|
|
115
123
|
const baseName = path.basename(pdf_path, '.pdf').replace(/[^a-zA-Z0-9_\-]/g, '_');
|
|
116
124
|
const result = await PdfService.batchFillAtCoordinates(pdf_path, field_definitions, data_rows, outDir, baseName, merge_into_single);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoform-mcp-server",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "MCP server for bulk PDF form filling. Detect fields, fill templates, and generate hundreds of PDFs from data — directly from Claude.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|