insureforge-mcp 0.1.2

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/.mcp.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "mcpServers": {
3
+ "insureforge": {
4
+ "command": "node",
5
+ "args": ["dist/index.js"],
6
+ "env": {
7
+ "INSUREFORGE_API_URL": "http://localhost:8124",
8
+ "INSUREFORGE_TIMEOUT": "60000"
9
+ }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * InsureForge MCP Server
4
+ *
5
+ * Provides MCP tools for Claude to interact with the InsureForge
6
+ * insurance document extraction service.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
package/dist/index.js ADDED
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * InsureForge MCP Server
4
+ *
5
+ * Provides MCP tools for Claude to interact with the InsureForge
6
+ * insurance document extraction service.
7
+ */
8
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
9
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
11
+ import { InsureForgeApiClient } from './services/api-client.js';
12
+ import { checkStatusInput, createExtractionInput, downloadDocumentInput, exportDocumentInput, getResultInput, listExportersInput, toolDefinitions, ToolHandlers, uploadFilesInput, } from './tools/index.js';
13
+ // Configuration from environment
14
+ const INSUREFORGE_API_URL = process.env.INSUREFORGE_API_URL;
15
+ const INSUREFORGE_TIMEOUT = parseInt(process.env.INSUREFORGE_TIMEOUT || '60000', 10);
16
+ if (!INSUREFORGE_API_URL) {
17
+ console.error('Error: INSUREFORGE_API_URL environment variable is required');
18
+ console.error('Example: INSUREFORGE_API_URL=https://aig-insure-forge.ragents.net');
19
+ process.exit(1);
20
+ }
21
+ // Create API client
22
+ const apiClient = new InsureForgeApiClient({
23
+ baseUrl: INSUREFORGE_API_URL,
24
+ timeout: INSUREFORGE_TIMEOUT,
25
+ });
26
+ // Create tool handlers
27
+ const handlers = new ToolHandlers(apiClient);
28
+ // Create MCP server
29
+ const server = new Server({
30
+ name: 'insureforge-mcp',
31
+ version: '0.1.0',
32
+ }, {
33
+ capabilities: {
34
+ tools: {},
35
+ },
36
+ });
37
+ // Handle list tools request
38
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
39
+ return {
40
+ tools: Object.values(toolDefinitions),
41
+ };
42
+ });
43
+ // Handle tool calls
44
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
45
+ const { name, arguments: args } = request.params;
46
+ try {
47
+ switch (name) {
48
+ case 'upload_files': {
49
+ const input = uploadFilesInput.parse(args);
50
+ return await handlers.uploadFiles(input);
51
+ }
52
+ case 'create_extraction': {
53
+ const input = createExtractionInput.parse(args);
54
+ return await handlers.createExtraction(input);
55
+ }
56
+ case 'check_status': {
57
+ const input = checkStatusInput.parse(args);
58
+ return await handlers.checkStatus(input);
59
+ }
60
+ case 'get_result': {
61
+ const input = getResultInput.parse(args);
62
+ return await handlers.getResult(input);
63
+ }
64
+ case 'download_document': {
65
+ const input = downloadDocumentInput.parse(args);
66
+ return await handlers.downloadDocument(input);
67
+ }
68
+ case 'list_exporters': {
69
+ const input = listExportersInput.parse(args);
70
+ return await handlers.listExporters(input);
71
+ }
72
+ case 'export_document': {
73
+ const input = exportDocumentInput.parse(args);
74
+ return await handlers.exportDocument(input);
75
+ }
76
+ default:
77
+ return {
78
+ content: [
79
+ {
80
+ type: 'text',
81
+ text: `Unknown tool: ${name}`,
82
+ },
83
+ ],
84
+ isError: true,
85
+ };
86
+ }
87
+ }
88
+ catch (error) {
89
+ const message = error instanceof Error ? error.message : String(error);
90
+ return {
91
+ content: [
92
+ {
93
+ type: 'text',
94
+ text: JSON.stringify({ error: message }, null, 2),
95
+ },
96
+ ],
97
+ isError: true,
98
+ };
99
+ }
100
+ });
101
+ // Main entry point
102
+ async function main() {
103
+ // Check API connectivity
104
+ try {
105
+ const health = await apiClient.healthCheck();
106
+ console.error(`Connected to InsureForge API v${health.version}`);
107
+ }
108
+ catch (error) {
109
+ console.error(`Warning: Could not connect to InsureForge API at ${INSUREFORGE_API_URL}`);
110
+ console.error('The server will start, but tools may fail until the API is available.');
111
+ }
112
+ // Start the server
113
+ const transport = new StdioServerTransport();
114
+ await server.connect(transport);
115
+ console.error('InsureForge MCP Server running on stdio');
116
+ }
117
+ main().catch((error) => {
118
+ console.error('Fatal error:', error);
119
+ process.exit(1);
120
+ });
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,iCAAiC;AACjC,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;AAC5D,MAAM,mBAAmB,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;AAErF,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,6DAA6D,C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,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAClD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,yBAAyB;IACzB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC,iCAAiC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oDAAoD,mBAAmB,EAAE,CAAC,CAAC;QACzF,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;IACzF,CAAC;IAED,mBAAmB;IACnB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * HTTP client for InsureForge API
3
+ */
4
+ import type { ExportersResponse, ExtractResponse, InsureForgeConfig, JobResponse, JobResultResponse, UploadResponse } from '../types/index.js';
5
+ export declare class InsureForgeApiClient {
6
+ private baseUrl;
7
+ private timeout;
8
+ constructor(config: InsureForgeConfig);
9
+ private request;
10
+ /**
11
+ * Upload files to InsureForge
12
+ */
13
+ uploadFiles(filePaths: string[]): Promise<UploadResponse>;
14
+ /**
15
+ * Create an extraction job
16
+ */
17
+ createExtraction(groupId: string, fileIds?: string[]): Promise<ExtractResponse>;
18
+ /**
19
+ * Get job status
20
+ */
21
+ getJobStatus(jobId: string): Promise<JobResponse>;
22
+ /**
23
+ * Get extraction result
24
+ */
25
+ getJobResult(jobId: string): Promise<JobResultResponse>;
26
+ /**
27
+ * Download result file
28
+ */
29
+ downloadResult(jobId: string, format?: 'json' | 'docx'): Promise<Buffer>;
30
+ /**
31
+ * Health check
32
+ */
33
+ healthCheck(): Promise<{
34
+ status: string;
35
+ version: string;
36
+ }>;
37
+ /**
38
+ * List available exporters
39
+ */
40
+ listExporters(): Promise<ExportersResponse>;
41
+ /**
42
+ * Export job result using specified exporter
43
+ */
44
+ exportDocument(jobId: string, exporterName: string): Promise<Buffer>;
45
+ }
46
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/services/api-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAEV,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,iBAAiB;YAKvB,OAAO;IA2CrB;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAkB/D;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAMrF;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvD;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI7D;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,MAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBtF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAIjE;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAIjD;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAuB3E"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * HTTP client for InsureForge API
3
+ */
4
+ import * as fs from 'fs';
5
+ import * as path from 'path';
6
+ export class InsureForgeApiClient {
7
+ baseUrl;
8
+ timeout;
9
+ constructor(config) {
10
+ this.baseUrl = config.baseUrl.replace(/\/$/, '');
11
+ this.timeout = config.timeout ?? 30000;
12
+ }
13
+ async request(method, endpoint, options) {
14
+ const url = `${this.baseUrl}${endpoint}`;
15
+ const headers = {};
16
+ let body;
17
+ if (options?.formData) {
18
+ body = options.formData;
19
+ // Don't set Content-Type for FormData, let fetch handle it
20
+ }
21
+ else if (options?.body) {
22
+ headers['Content-Type'] = 'application/json';
23
+ body = JSON.stringify(options.body);
24
+ }
25
+ const controller = new AbortController();
26
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
27
+ try {
28
+ const response = await fetch(url, {
29
+ method,
30
+ headers,
31
+ body,
32
+ signal: controller.signal,
33
+ });
34
+ if (!response.ok) {
35
+ const errorData = (await response.json().catch(() => ({})));
36
+ throw new Error(errorData.error || `HTTP ${response.status}: ${response.statusText}`);
37
+ }
38
+ return (await response.json());
39
+ }
40
+ finally {
41
+ clearTimeout(timeoutId);
42
+ }
43
+ }
44
+ /**
45
+ * Upload files to InsureForge
46
+ */
47
+ async uploadFiles(filePaths) {
48
+ const formData = new FormData();
49
+ for (const filePath of filePaths) {
50
+ const absolutePath = path.resolve(filePath);
51
+ if (!fs.existsSync(absolutePath)) {
52
+ throw new Error(`File not found: ${absolutePath}`);
53
+ }
54
+ const fileBuffer = fs.readFileSync(absolutePath);
55
+ const fileName = path.basename(absolutePath);
56
+ const blob = new Blob([fileBuffer]);
57
+ formData.append('files', blob, fileName);
58
+ }
59
+ return this.request('POST', '/api/v1/upload', { formData });
60
+ }
61
+ /**
62
+ * Create an extraction job
63
+ */
64
+ async createExtraction(groupId, fileIds) {
65
+ return this.request('POST', '/api/v1/extract', {
66
+ body: { groupId, fileIds },
67
+ });
68
+ }
69
+ /**
70
+ * Get job status
71
+ */
72
+ async getJobStatus(jobId) {
73
+ return this.request('GET', `/api/v1/jobs/${jobId}`);
74
+ }
75
+ /**
76
+ * Get extraction result
77
+ */
78
+ async getJobResult(jobId) {
79
+ return this.request('GET', `/api/v1/jobs/${jobId}/result`);
80
+ }
81
+ /**
82
+ * Download result file
83
+ */
84
+ async downloadResult(jobId, format = 'json') {
85
+ const url = `${this.baseUrl}/api/v1/jobs/${jobId}/download?format=${format}`;
86
+ const controller = new AbortController();
87
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
88
+ try {
89
+ const response = await fetch(url, {
90
+ method: 'GET',
91
+ signal: controller.signal,
92
+ });
93
+ if (!response.ok) {
94
+ const errorData = (await response.json().catch(() => ({})));
95
+ throw new Error(errorData.error || `HTTP ${response.status}: ${response.statusText}`);
96
+ }
97
+ const arrayBuffer = await response.arrayBuffer();
98
+ return Buffer.from(arrayBuffer);
99
+ }
100
+ finally {
101
+ clearTimeout(timeoutId);
102
+ }
103
+ }
104
+ /**
105
+ * Health check
106
+ */
107
+ async healthCheck() {
108
+ return this.request('GET', '/health');
109
+ }
110
+ /**
111
+ * List available exporters
112
+ */
113
+ async listExporters() {
114
+ return this.request('GET', '/api/v1/export/exporters');
115
+ }
116
+ /**
117
+ * Export job result using specified exporter
118
+ */
119
+ async exportDocument(jobId, exporterName) {
120
+ const url = `${this.baseUrl}/api/v1/export/jobs/${jobId}/${exporterName}`;
121
+ const controller = new AbortController();
122
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
123
+ try {
124
+ const response = await fetch(url, {
125
+ method: 'GET',
126
+ signal: controller.signal,
127
+ });
128
+ if (!response.ok) {
129
+ const errorData = (await response.json().catch(() => ({})));
130
+ throw new Error(errorData.error || `HTTP ${response.status}: ${response.statusText}`);
131
+ }
132
+ const arrayBuffer = await response.arrayBuffer();
133
+ return Buffer.from(arrayBuffer);
134
+ }
135
+ finally {
136
+ clearTimeout(timeoutId);
137
+ }
138
+ }
139
+ }
140
+ //# sourceMappingURL=api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/services/api-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAY7B,MAAM,OAAO,oBAAoB;IACvB,OAAO,CAAS;IAChB,OAAO,CAAS;IAExB,YAAY,MAAyB;QACnC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,OAAO,CACnB,MAAc,EACd,QAAgB,EAChB,OAGC;QAED,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;QAEzC,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,IAAmC,CAAC;QAExC,IAAI,OAAO,EAAE,QAAQ,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AG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAErE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAChC,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAa,CAAC;gBACxE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YACxF,CAAC;YAED,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;YACjD,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * MCP Tools for InsureForge
3
+ */
4
+ import { z } from 'zod';
5
+ import type { InsureForgeApiClient } from '../services/api-client.js';
6
+ export declare const toolDefinitions: {
7
+ readonly upload_files: {
8
+ readonly name: "upload_files";
9
+ readonly description: "Upload insurance documents (DOCX, PDF, MSG, images) for data extraction. Returns a group ID that can be used to create an extraction job.";
10
+ readonly inputSchema: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly filePaths: {
14
+ readonly type: "array";
15
+ readonly items: {
16
+ readonly type: "string";
17
+ };
18
+ readonly description: "Array of absolute file paths to upload";
19
+ };
20
+ };
21
+ readonly required: readonly ["filePaths"];
22
+ };
23
+ };
24
+ readonly create_extraction: {
25
+ readonly name: "create_extraction";
26
+ readonly description: "Create an extraction job to process uploaded documents. The extraction runs asynchronously. Use check_status to monitor progress.";
27
+ readonly inputSchema: {
28
+ readonly type: "object";
29
+ readonly properties: {
30
+ readonly groupId: {
31
+ readonly type: "string";
32
+ readonly description: "Upload group ID from upload_files";
33
+ };
34
+ readonly fileIds: {
35
+ readonly type: "array";
36
+ readonly items: {
37
+ readonly type: "string";
38
+ };
39
+ readonly description: "Optional specific file IDs to process. If not provided, all files in the group are processed.";
40
+ };
41
+ };
42
+ readonly required: readonly ["groupId"];
43
+ };
44
+ };
45
+ readonly check_status: {
46
+ readonly name: "check_status";
47
+ readonly description: "Check the status and progress of an extraction job.";
48
+ readonly inputSchema: {
49
+ readonly type: "object";
50
+ readonly properties: {
51
+ readonly jobId: {
52
+ readonly type: "string";
53
+ readonly description: "Job ID from create_extraction";
54
+ };
55
+ };
56
+ readonly required: readonly ["jobId"];
57
+ };
58
+ };
59
+ readonly get_result: {
60
+ readonly name: "get_result";
61
+ readonly description: "Get the extraction result for a completed job. Returns extracted data, confidence scores, and any fields that need confirmation.";
62
+ readonly inputSchema: {
63
+ readonly type: "object";
64
+ readonly properties: {
65
+ readonly jobId: {
66
+ readonly type: "string";
67
+ readonly description: "Job ID from create_extraction";
68
+ };
69
+ };
70
+ readonly required: readonly ["jobId"];
71
+ };
72
+ };
73
+ readonly list_exporters: {
74
+ readonly name: "list_exporters";
75
+ readonly description: "List all available document exporters. Each exporter can generate a specific type of document (e.g., \"产品责任保险报价单\", \"原始 JSON 数据\").";
76
+ readonly inputSchema: {
77
+ readonly type: "object";
78
+ readonly properties: {};
79
+ readonly required: readonly [];
80
+ };
81
+ };
82
+ readonly export_document: {
83
+ readonly name: "export_document";
84
+ readonly description: "Export extraction result to a document using a specific exporter. Use list_exporters to see available exporters. Example exporters: \"product_liability_quotation\" (产品责任保险报价单), \"raw_json\" (原始 JSON 数据).";
85
+ readonly inputSchema: {
86
+ readonly type: "object";
87
+ readonly properties: {
88
+ readonly jobId: {
89
+ readonly type: "string";
90
+ readonly description: "Job ID from create_extraction";
91
+ };
92
+ readonly exporterName: {
93
+ readonly type: "string";
94
+ readonly description: "Name of the exporter to use (e.g., \"product_liability_quotation\", \"raw_json\")";
95
+ };
96
+ readonly outputPath: {
97
+ readonly type: "string";
98
+ readonly description: "Path to save the exported document";
99
+ };
100
+ };
101
+ readonly required: readonly ["jobId", "exporterName", "outputPath"];
102
+ };
103
+ };
104
+ readonly download_document: {
105
+ readonly name: "download_document";
106
+ readonly description: "[DEPRECATED] Use export_document instead. Download the extraction result as a JSON file or generated DOCX document.";
107
+ readonly inputSchema: {
108
+ readonly type: "object";
109
+ readonly properties: {
110
+ readonly jobId: {
111
+ readonly type: "string";
112
+ readonly description: "Job ID from create_extraction";
113
+ };
114
+ readonly format: {
115
+ readonly type: "string";
116
+ readonly enum: readonly ["json", "docx"];
117
+ readonly description: "Output format: json for raw data, docx for generated application form";
118
+ };
119
+ readonly outputPath: {
120
+ readonly type: "string";
121
+ readonly description: "Path to save the downloaded file";
122
+ };
123
+ };
124
+ readonly required: readonly ["jobId", "format", "outputPath"];
125
+ };
126
+ };
127
+ };
128
+ export declare const uploadFilesInput: z.ZodObject<{
129
+ filePaths: z.ZodArray<z.ZodString, "many">;
130
+ }, "strip", z.ZodTypeAny, {
131
+ filePaths: string[];
132
+ }, {
133
+ filePaths: string[];
134
+ }>;
135
+ export declare const createExtractionInput: z.ZodObject<{
136
+ groupId: z.ZodString;
137
+ fileIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
+ }, "strip", z.ZodTypeAny, {
139
+ groupId: string;
140
+ fileIds?: string[] | undefined;
141
+ }, {
142
+ groupId: string;
143
+ fileIds?: string[] | undefined;
144
+ }>;
145
+ export declare const checkStatusInput: z.ZodObject<{
146
+ jobId: z.ZodString;
147
+ }, "strip", z.ZodTypeAny, {
148
+ jobId: string;
149
+ }, {
150
+ jobId: string;
151
+ }>;
152
+ export declare const getResultInput: z.ZodObject<{
153
+ jobId: z.ZodString;
154
+ }, "strip", z.ZodTypeAny, {
155
+ jobId: string;
156
+ }, {
157
+ jobId: string;
158
+ }>;
159
+ export declare const listExportersInput: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
160
+ export declare const exportDocumentInput: z.ZodObject<{
161
+ jobId: z.ZodString;
162
+ exporterName: z.ZodString;
163
+ outputPath: z.ZodString;
164
+ }, "strip", z.ZodTypeAny, {
165
+ jobId: string;
166
+ exporterName: string;
167
+ outputPath: string;
168
+ }, {
169
+ jobId: string;
170
+ exporterName: string;
171
+ outputPath: string;
172
+ }>;
173
+ export declare const downloadDocumentInput: z.ZodObject<{
174
+ jobId: z.ZodString;
175
+ format: z.ZodEnum<["json", "docx"]>;
176
+ outputPath: z.ZodString;
177
+ }, "strip", z.ZodTypeAny, {
178
+ jobId: string;
179
+ outputPath: string;
180
+ format: "json" | "docx";
181
+ }, {
182
+ jobId: string;
183
+ outputPath: string;
184
+ format: "json" | "docx";
185
+ }>;
186
+ export declare class ToolHandlers {
187
+ private client;
188
+ constructor(client: InsureForgeApiClient);
189
+ uploadFiles(input: z.infer<typeof uploadFilesInput>): Promise<{
190
+ content: {
191
+ type: "text";
192
+ text: string;
193
+ }[];
194
+ }>;
195
+ createExtraction(input: z.infer<typeof createExtractionInput>): Promise<{
196
+ content: {
197
+ type: "text";
198
+ text: string;
199
+ }[];
200
+ }>;
201
+ checkStatus(input: z.infer<typeof checkStatusInput>): Promise<{
202
+ content: {
203
+ type: "text";
204
+ text: string;
205
+ }[];
206
+ }>;
207
+ getResult(input: z.infer<typeof getResultInput>): Promise<{
208
+ content: {
209
+ type: "text";
210
+ text: string;
211
+ }[];
212
+ }>;
213
+ listExporters(_input: z.infer<typeof listExportersInput>): Promise<{
214
+ content: {
215
+ type: "text";
216
+ text: string;
217
+ }[];
218
+ }>;
219
+ exportDocument(input: z.infer<typeof exportDocumentInput>): Promise<{
220
+ content: {
221
+ type: "text";
222
+ text: string;
223
+ }[];
224
+ }>;
225
+ downloadDocument(input: z.infer<typeof downloadDocumentInput>): Promise<{
226
+ content: {
227
+ type: "text";
228
+ text: string;
229
+ }[];
230
+ }>;
231
+ }
232
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGtE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIlB,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,kBAAkB,gDAAe,CAAC;AAE/C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAC;AAGH,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,oBAAoB;IAE1C,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;;;;;IAyBnD,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;IAqB7D,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;;;;;I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