pdfco-mcp 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl
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.
- pdfco/mcp/__init__.py +19 -3
- pdfco/mcp/models.py +140 -49
- pdfco/mcp/services/client.py +14 -12
- pdfco/mcp/services/pdf.py +96 -38
- pdfco/mcp/tools/apis/conversion.py +979 -202
- pdfco/mcp/tools/apis/document.py +21 -7
- pdfco/mcp/tools/apis/editing.py +54 -24
- pdfco/mcp/tools/apis/extraction.py +21 -7
- pdfco/mcp/tools/apis/file.py +10 -6
- pdfco/mcp/tools/apis/form.py +64 -21
- pdfco/mcp/tools/apis/job.py +22 -7
- pdfco/mcp/tools/apis/modification.py +51 -14
- pdfco/mcp/tools/apis/search.py +61 -19
- pdfco/mcp/tools/apis/searchable.py +57 -18
- pdfco/mcp/tools/apis/security.py +97 -37
- {pdfco_mcp-0.0.3.dist-info → pdfco_mcp-0.0.5.dist-info}/METADATA +38 -7
- pdfco_mcp-0.0.5.dist-info/RECORD +23 -0
- pdfco_mcp-0.0.3.dist-info/RECORD +0 -23
- {pdfco_mcp-0.0.3.dist-info → pdfco_mcp-0.0.5.dist-info}/WHEEL +0 -0
- {pdfco_mcp-0.0.3.dist-info → pdfco_mcp-0.0.5.dist-info}/entry_points.txt +0 -0
- {pdfco_mcp-0.0.3.dist-info → pdfco_mcp-0.0.5.dist-info}/licenses/LICENSE +0 -0
@@ -3,161 +3,525 @@ from pdfco.mcp.services.pdf import convert_to, convert_from
|
|
3
3
|
from pdfco.mcp.models import BaseResponse, ConversionParams
|
4
4
|
|
5
5
|
from pydantic import Field
|
6
|
-
|
6
|
+
|
7
|
+
|
7
8
|
@mcp.tool()
|
8
9
|
async def pdf_to_json(
|
9
|
-
url: str = Field(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
url: str = Field(
|
11
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
12
|
+
),
|
13
|
+
httpusername: str = Field(
|
14
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
15
|
+
default="",
|
16
|
+
),
|
17
|
+
httppassword: str = Field(
|
18
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
19
|
+
default="",
|
20
|
+
),
|
21
|
+
pages: str = Field(
|
22
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
23
|
+
default="",
|
24
|
+
),
|
25
|
+
unwrap: bool = Field(
|
26
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
27
|
+
default=False,
|
28
|
+
),
|
29
|
+
rect: str = Field(
|
30
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
31
|
+
default="",
|
32
|
+
),
|
33
|
+
lang: str = Field(
|
34
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
35
|
+
default="eng",
|
36
|
+
),
|
37
|
+
line_grouping: str = Field(
|
38
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
39
|
+
default="0",
|
40
|
+
),
|
41
|
+
password: str = Field(
|
42
|
+
description="Password of the PDF file. (Optional)", default=""
|
43
|
+
),
|
44
|
+
name: str = Field(
|
45
|
+
description="File name for the generated output. (Optional)", default=""
|
46
|
+
),
|
47
|
+
api_key: str = Field(
|
48
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
49
|
+
default=None,
|
50
|
+
),
|
20
51
|
) -> BaseResponse:
|
21
52
|
"""
|
22
53
|
Convert PDF and scanned images into JSON representation with text, fonts, images, vectors, and formatting preserved using the /pdf/convert/to/json2 endpoint.
|
23
54
|
Ref: https://developer.pdf.co/api-reference/pdf-to-json/basic.md
|
24
55
|
"""
|
25
|
-
return await convert_to(
|
56
|
+
return await convert_to(
|
57
|
+
"pdf",
|
58
|
+
"json2",
|
59
|
+
ConversionParams(
|
60
|
+
url=url,
|
61
|
+
httpusername=httpusername,
|
62
|
+
httppassword=httppassword,
|
63
|
+
pages=pages,
|
64
|
+
unwrap=unwrap,
|
65
|
+
rect=rect,
|
66
|
+
lang=lang,
|
67
|
+
line_grouping=line_grouping,
|
68
|
+
password=password,
|
69
|
+
name=name,
|
70
|
+
),
|
71
|
+
api_key=api_key,
|
72
|
+
)
|
73
|
+
|
26
74
|
|
27
75
|
@mcp.tool()
|
28
76
|
async def pdf_to_csv(
|
29
|
-
url: str = Field(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
77
|
+
url: str = Field(
|
78
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
79
|
+
),
|
80
|
+
httpusername: str = Field(
|
81
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
82
|
+
default="",
|
83
|
+
),
|
84
|
+
httppassword: str = Field(
|
85
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
86
|
+
default="",
|
87
|
+
),
|
88
|
+
pages: str = Field(
|
89
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
90
|
+
default="",
|
91
|
+
),
|
92
|
+
unwrap: bool = Field(
|
93
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
94
|
+
default=False,
|
95
|
+
),
|
96
|
+
rect: str = Field(
|
97
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
98
|
+
default="",
|
99
|
+
),
|
100
|
+
lang: str = Field(
|
101
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
102
|
+
default="eng",
|
103
|
+
),
|
104
|
+
line_grouping: str = Field(
|
105
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
106
|
+
default="0",
|
107
|
+
),
|
108
|
+
password: str = Field(
|
109
|
+
description="Password of the PDF file. (Optional)", default=""
|
110
|
+
),
|
111
|
+
name: str = Field(
|
112
|
+
description="File name for the generated output. (Optional)", default=""
|
113
|
+
),
|
114
|
+
api_key: str = Field(
|
115
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
116
|
+
default=None,
|
117
|
+
),
|
40
118
|
) -> BaseResponse:
|
41
119
|
"""
|
42
120
|
Convert PDF and scanned images into CSV representation with layout, columns, rows, and tables.
|
43
121
|
Ref: https://developer.pdf.co/api-reference/pdf-to-csv.md
|
44
122
|
"""
|
45
|
-
return await convert_to(
|
123
|
+
return await convert_to(
|
124
|
+
"pdf",
|
125
|
+
"csv",
|
126
|
+
ConversionParams(
|
127
|
+
url=url,
|
128
|
+
httpusername=httpusername,
|
129
|
+
httppassword=httppassword,
|
130
|
+
pages=pages,
|
131
|
+
unwrap=unwrap,
|
132
|
+
rect=rect,
|
133
|
+
lang=lang,
|
134
|
+
line_grouping=line_grouping,
|
135
|
+
password=password,
|
136
|
+
name=name,
|
137
|
+
api_key=api_key,
|
138
|
+
),
|
139
|
+
)
|
140
|
+
|
46
141
|
|
47
142
|
@mcp.tool()
|
48
143
|
async def pdf_to_text(
|
49
|
-
url: str = Field(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
144
|
+
url: str = Field(
|
145
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
146
|
+
),
|
147
|
+
httpusername: str = Field(
|
148
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
149
|
+
default="",
|
150
|
+
),
|
151
|
+
httppassword: str = Field(
|
152
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
153
|
+
default="",
|
154
|
+
),
|
155
|
+
pages: str = Field(
|
156
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
157
|
+
default="",
|
158
|
+
),
|
159
|
+
unwrap: bool = Field(
|
160
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
161
|
+
default=False,
|
162
|
+
),
|
163
|
+
rect: str = Field(
|
164
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
165
|
+
default="",
|
166
|
+
),
|
167
|
+
lang: str = Field(
|
168
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
169
|
+
default="eng",
|
170
|
+
),
|
171
|
+
line_grouping: str = Field(
|
172
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
173
|
+
default="0",
|
174
|
+
),
|
175
|
+
password: str = Field(
|
176
|
+
description="Password of the PDF file. (Optional)", default=""
|
177
|
+
),
|
178
|
+
name: str = Field(
|
179
|
+
description="File name for the generated output. (Optional)", default=""
|
180
|
+
),
|
181
|
+
api_key: str = Field(
|
182
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
183
|
+
default=None,
|
184
|
+
),
|
60
185
|
) -> BaseResponse:
|
61
186
|
"""
|
62
187
|
Convert PDF and scanned images to text with layout preserved.
|
63
188
|
Ref: https://developer.pdf.co/api-reference/pdf-to-text/basic.md
|
64
189
|
"""
|
65
|
-
return await convert_to(
|
190
|
+
return await convert_to(
|
191
|
+
"pdf",
|
192
|
+
"text",
|
193
|
+
ConversionParams(
|
194
|
+
url=url,
|
195
|
+
httpusername=httpusername,
|
196
|
+
httppassword=httppassword,
|
197
|
+
pages=pages,
|
198
|
+
unwrap=unwrap,
|
199
|
+
rect=rect,
|
200
|
+
lang=lang,
|
201
|
+
line_grouping=line_grouping,
|
202
|
+
password=password,
|
203
|
+
name=name,
|
204
|
+
api_key=api_key,
|
205
|
+
),
|
206
|
+
)
|
207
|
+
|
66
208
|
|
67
209
|
@mcp.tool()
|
68
210
|
async def pdf_to_xls(
|
69
|
-
url: str = Field(
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
211
|
+
url: str = Field(
|
212
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
213
|
+
),
|
214
|
+
httpusername: str = Field(
|
215
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
216
|
+
default="",
|
217
|
+
),
|
218
|
+
httppassword: str = Field(
|
219
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
220
|
+
default="",
|
221
|
+
),
|
222
|
+
pages: str = Field(
|
223
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
224
|
+
default="",
|
225
|
+
),
|
226
|
+
unwrap: bool = Field(
|
227
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
228
|
+
default=False,
|
229
|
+
),
|
230
|
+
rect: str = Field(
|
231
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
232
|
+
default="",
|
233
|
+
),
|
234
|
+
lang: str = Field(
|
235
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
236
|
+
default="eng",
|
237
|
+
),
|
238
|
+
line_grouping: str = Field(
|
239
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
240
|
+
default="0",
|
241
|
+
),
|
242
|
+
password: str = Field(
|
243
|
+
description="Password of the PDF file. (Optional)", default=""
|
244
|
+
),
|
245
|
+
name: str = Field(
|
246
|
+
description="File name for the generated output. (Optional)", default=""
|
247
|
+
),
|
248
|
+
api_key: str = Field(
|
249
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
250
|
+
default=None,
|
251
|
+
),
|
80
252
|
) -> BaseResponse:
|
81
253
|
"""
|
82
254
|
Convert PDF and scanned images to XLS (Excel 97-2003) format.
|
83
255
|
Ref: https://developer.pdf.co/api-reference/pdf-to-excel/xls.md
|
84
256
|
"""
|
85
|
-
return await convert_to(
|
257
|
+
return await convert_to(
|
258
|
+
"pdf",
|
259
|
+
"xls",
|
260
|
+
ConversionParams(
|
261
|
+
url=url,
|
262
|
+
httpusername=httpusername,
|
263
|
+
httppassword=httppassword,
|
264
|
+
pages=pages,
|
265
|
+
unwrap=unwrap,
|
266
|
+
rect=rect,
|
267
|
+
lang=lang,
|
268
|
+
line_grouping=line_grouping,
|
269
|
+
password=password,
|
270
|
+
name=name,
|
271
|
+
api_key=api_key,
|
272
|
+
),
|
273
|
+
)
|
274
|
+
|
86
275
|
|
87
276
|
@mcp.tool()
|
88
277
|
async def pdf_to_xlsx(
|
89
|
-
url: str = Field(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
278
|
+
url: str = Field(
|
279
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
280
|
+
),
|
281
|
+
httpusername: str = Field(
|
282
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
283
|
+
default="",
|
284
|
+
),
|
285
|
+
httppassword: str = Field(
|
286
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
287
|
+
default="",
|
288
|
+
),
|
289
|
+
pages: str = Field(
|
290
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
291
|
+
default="",
|
292
|
+
),
|
293
|
+
unwrap: bool = Field(
|
294
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
295
|
+
default=False,
|
296
|
+
),
|
297
|
+
rect: str = Field(
|
298
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
299
|
+
default="",
|
300
|
+
),
|
301
|
+
lang: str = Field(
|
302
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
303
|
+
default="eng",
|
304
|
+
),
|
305
|
+
line_grouping: str = Field(
|
306
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
307
|
+
default="0",
|
308
|
+
),
|
309
|
+
password: str = Field(
|
310
|
+
description="Password of the PDF file. (Optional)", default=""
|
311
|
+
),
|
312
|
+
name: str = Field(
|
313
|
+
description="File name for the generated output. (Optional)", default=""
|
314
|
+
),
|
315
|
+
api_key: str = Field(
|
316
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
317
|
+
default=None,
|
318
|
+
),
|
100
319
|
) -> BaseResponse:
|
101
320
|
"""
|
102
|
-
Convert PDF and scanned images to XLSX (Excel 2007+) format.
|
321
|
+
Convert PDF and scanned images to XLSX (Excel 2007+) format.
|
103
322
|
Ref: https://developer.pdf.co/api-reference/pdf-to-excel/xlsx.md
|
104
323
|
"""
|
105
|
-
return await convert_to(
|
324
|
+
return await convert_to(
|
325
|
+
"pdf",
|
326
|
+
"xlsx",
|
327
|
+
ConversionParams(
|
328
|
+
url=url,
|
329
|
+
httpusername=httpusername,
|
330
|
+
httppassword=httppassword,
|
331
|
+
pages=pages,
|
332
|
+
unwrap=unwrap,
|
333
|
+
rect=rect,
|
334
|
+
lang=lang,
|
335
|
+
line_grouping=line_grouping,
|
336
|
+
password=password,
|
337
|
+
name=name,
|
338
|
+
api_key=api_key,
|
339
|
+
),
|
340
|
+
)
|
341
|
+
|
106
342
|
|
107
343
|
@mcp.tool()
|
108
344
|
async def pdf_to_xml(
|
109
|
-
url: str = Field(
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
345
|
+
url: str = Field(
|
346
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
347
|
+
),
|
348
|
+
httpusername: str = Field(
|
349
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
350
|
+
default="",
|
351
|
+
),
|
352
|
+
httppassword: str = Field(
|
353
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
354
|
+
default="",
|
355
|
+
),
|
356
|
+
pages: str = Field(
|
357
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
358
|
+
default="",
|
359
|
+
),
|
360
|
+
unwrap: bool = Field(
|
361
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
362
|
+
default=False,
|
363
|
+
),
|
364
|
+
rect: str = Field(
|
365
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
366
|
+
default="",
|
367
|
+
),
|
368
|
+
lang: str = Field(
|
369
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
370
|
+
default="eng",
|
371
|
+
),
|
372
|
+
line_grouping: str = Field(
|
373
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
374
|
+
default="0",
|
375
|
+
),
|
376
|
+
password: str = Field(
|
377
|
+
description="Password of the PDF file. (Optional)", default=""
|
378
|
+
),
|
379
|
+
name: str = Field(
|
380
|
+
description="File name for the generated output. (Optional)", default=""
|
381
|
+
),
|
382
|
+
api_key: str = Field(
|
383
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
384
|
+
default=None,
|
385
|
+
),
|
120
386
|
) -> BaseResponse:
|
121
387
|
"""
|
122
388
|
Convert PDF and scanned images to XML format.
|
123
389
|
Ref: https://developer.pdf.co/api-reference/pdf-to-xml.md
|
124
390
|
"""
|
125
|
-
return await convert_to(
|
391
|
+
return await convert_to(
|
392
|
+
"pdf",
|
393
|
+
"xml",
|
394
|
+
ConversionParams(
|
395
|
+
url=url,
|
396
|
+
httpusername=httpusername,
|
397
|
+
httppassword=httppassword,
|
398
|
+
pages=pages,
|
399
|
+
unwrap=unwrap,
|
400
|
+
rect=rect,
|
401
|
+
lang=lang,
|
402
|
+
line_grouping=line_grouping,
|
403
|
+
password=password,
|
404
|
+
name=name,
|
405
|
+
api_key=api_key,
|
406
|
+
),
|
407
|
+
)
|
408
|
+
|
126
409
|
|
127
410
|
@mcp.tool()
|
128
411
|
async def pdf_to_html(
|
129
|
-
url: str = Field(
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
412
|
+
url: str = Field(
|
413
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
414
|
+
),
|
415
|
+
httpusername: str = Field(
|
416
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
417
|
+
default="",
|
418
|
+
),
|
419
|
+
httppassword: str = Field(
|
420
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
421
|
+
default="",
|
422
|
+
),
|
423
|
+
pages: str = Field(
|
424
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
425
|
+
default="",
|
426
|
+
),
|
427
|
+
unwrap: bool = Field(
|
428
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
429
|
+
default=False,
|
430
|
+
),
|
431
|
+
rect: str = Field(
|
432
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
433
|
+
default="",
|
434
|
+
),
|
435
|
+
lang: str = Field(
|
436
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
437
|
+
default="eng",
|
438
|
+
),
|
439
|
+
line_grouping: str = Field(
|
440
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
441
|
+
default="0",
|
442
|
+
),
|
443
|
+
password: str = Field(
|
444
|
+
description="Password of the PDF file. (Optional)", default=""
|
445
|
+
),
|
446
|
+
name: str = Field(
|
447
|
+
description="File name for the generated output. (Optional)", default=""
|
448
|
+
),
|
449
|
+
api_key: str = Field(
|
450
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
451
|
+
default=None,
|
452
|
+
),
|
140
453
|
) -> BaseResponse:
|
141
454
|
"""
|
142
455
|
Convert PDF and scanned images to HTML format.
|
143
456
|
Ref: https://developer.pdf.co/api-reference/pdf-to-html.md
|
144
457
|
"""
|
145
|
-
return await convert_to(
|
458
|
+
return await convert_to(
|
459
|
+
"pdf",
|
460
|
+
"html",
|
461
|
+
ConversionParams(
|
462
|
+
url=url,
|
463
|
+
httpusername=httpusername,
|
464
|
+
httppassword=httppassword,
|
465
|
+
pages=pages,
|
466
|
+
unwrap=unwrap,
|
467
|
+
rect=rect,
|
468
|
+
lang=lang,
|
469
|
+
line_grouping=line_grouping,
|
470
|
+
password=password,
|
471
|
+
name=name,
|
472
|
+
api_key=api_key,
|
473
|
+
),
|
474
|
+
)
|
475
|
+
|
146
476
|
|
147
477
|
@mcp.tool()
|
148
478
|
async def pdf_to_image(
|
149
|
-
url: str = Field(
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
479
|
+
url: str = Field(
|
480
|
+
description="URL to the source file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
481
|
+
),
|
482
|
+
httpusername: str = Field(
|
483
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
484
|
+
default="",
|
485
|
+
),
|
486
|
+
httppassword: str = Field(
|
487
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
488
|
+
default="",
|
489
|
+
),
|
490
|
+
pages: str = Field(
|
491
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
492
|
+
default="",
|
493
|
+
),
|
494
|
+
unwrap: bool = Field(
|
495
|
+
description="Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be true or false. (Optional)",
|
496
|
+
default=False,
|
497
|
+
),
|
498
|
+
rect: str = Field(
|
499
|
+
description="Defines coordinates for extraction (e.g., '51.8,114.8,235.5,204.0'). (Optional)",
|
500
|
+
default="",
|
501
|
+
),
|
502
|
+
lang: str = Field(
|
503
|
+
description="Language for OCR for scanned documents. Default is 'eng'. See PDF.co docs for supported languages. (Optional, Default: 'eng')",
|
504
|
+
default="eng",
|
505
|
+
),
|
506
|
+
line_grouping: str = Field(
|
507
|
+
description="Enables line grouping within table cells when set to '1'. (Optional)",
|
508
|
+
default="0",
|
509
|
+
),
|
510
|
+
password: str = Field(
|
511
|
+
description="Password of the PDF file. (Optional)", default=""
|
512
|
+
),
|
513
|
+
name: str = Field(
|
514
|
+
description="File name for the generated output. (Optional)", default=""
|
515
|
+
),
|
516
|
+
type: str = Field(
|
517
|
+
description="Type of image to convert to. (jpg, png, webp, tiff) (Optional)",
|
518
|
+
default="jpg",
|
519
|
+
choices=["jpg", "png", "webp", "tiff"],
|
520
|
+
),
|
521
|
+
api_key: str = Field(
|
522
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
523
|
+
default=None,
|
524
|
+
),
|
161
525
|
) -> BaseResponse:
|
162
526
|
"""
|
163
527
|
Convert PDF and scanned images to various image formats (JPG, PNG, WebP, TIFF).
|
@@ -167,76 +531,220 @@ async def pdf_to_image(
|
|
167
531
|
- https://developer.pdf.co/api-reference/pdf-to-image/webp.md
|
168
532
|
- https://developer.pdf.co/api-reference/pdf-to-image/tiff.md
|
169
533
|
"""
|
170
|
-
return await convert_to(
|
534
|
+
return await convert_to(
|
535
|
+
"pdf",
|
536
|
+
type,
|
537
|
+
ConversionParams(
|
538
|
+
url=url,
|
539
|
+
httpusername=httpusername,
|
540
|
+
httppassword=httppassword,
|
541
|
+
pages=pages,
|
542
|
+
unwrap=unwrap,
|
543
|
+
rect=rect,
|
544
|
+
lang=lang,
|
545
|
+
line_grouping=line_grouping,
|
546
|
+
password=password,
|
547
|
+
name=name,
|
548
|
+
api_key=api_key,
|
549
|
+
),
|
550
|
+
)
|
551
|
+
|
171
552
|
|
172
553
|
@mcp.tool()
|
173
554
|
async def document_to_pdf(
|
174
|
-
url: str = Field(
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
555
|
+
url: str = Field(
|
556
|
+
description="URL to the source file (DOC, DOCX, RTF, TXT, XPS). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
557
|
+
),
|
558
|
+
autosize: bool = Field(
|
559
|
+
description="Controls automatic page sizing. If true, page dimensions adjust to content. If false, uses worksheet’s page setup. (Optional)",
|
560
|
+
default=False,
|
561
|
+
),
|
562
|
+
httpusername: str = Field(
|
563
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
564
|
+
default="",
|
565
|
+
),
|
566
|
+
httppassword: str = Field(
|
567
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
568
|
+
default="",
|
569
|
+
),
|
570
|
+
pages: str = Field(
|
571
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
572
|
+
default="",
|
573
|
+
),
|
574
|
+
name: str = Field(
|
575
|
+
description="File name for the generated output. (Optional)", default=""
|
576
|
+
),
|
577
|
+
api_key: str = Field(
|
578
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
579
|
+
default=None,
|
580
|
+
),
|
181
581
|
) -> BaseResponse:
|
182
582
|
"""
|
183
583
|
Convert various document types (DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, HTML, JPG, PNG, TIFF, WEBP) into PDF.
|
184
584
|
Ref: https://developer.pdf.co/api-reference/pdf-from-document/doc.md
|
185
585
|
"""
|
186
|
-
return await convert_from(
|
586
|
+
return await convert_from(
|
587
|
+
"pdf",
|
588
|
+
"doc",
|
589
|
+
ConversionParams(
|
590
|
+
url=url,
|
591
|
+
autosize=autosize,
|
592
|
+
httpusername=httpusername,
|
593
|
+
httppassword=httppassword,
|
594
|
+
pages=pages,
|
595
|
+
name=name,
|
596
|
+
api_key=api_key,
|
597
|
+
),
|
598
|
+
)
|
599
|
+
|
187
600
|
|
188
601
|
@mcp.tool()
|
189
602
|
async def csv_to_pdf(
|
190
|
-
url: str = Field(
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
603
|
+
url: str = Field(
|
604
|
+
description="URL to the source file (CSV, XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
605
|
+
),
|
606
|
+
autosize: bool = Field(
|
607
|
+
description="Controls automatic page sizing. If true, page dimensions adjust to content. If false, uses worksheet’s page setup. (Optional)",
|
608
|
+
default=False,
|
609
|
+
),
|
610
|
+
httpusername: str = Field(
|
611
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
612
|
+
default="",
|
613
|
+
),
|
614
|
+
httppassword: str = Field(
|
615
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
616
|
+
default="",
|
617
|
+
),
|
618
|
+
pages: str = Field(
|
619
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
620
|
+
default="",
|
621
|
+
),
|
622
|
+
name: str = Field(
|
623
|
+
description="File name for the generated output. (Optional)", default=""
|
624
|
+
),
|
625
|
+
api_key: str = Field(
|
626
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
627
|
+
default=None,
|
628
|
+
),
|
197
629
|
) -> BaseResponse:
|
198
630
|
"""
|
199
631
|
Convert CSV or spreadsheet files (XLS, XLSX) to PDF.
|
200
632
|
Ref: https://developer.pdf.co/api-reference/pdf-from-document/csv.md
|
201
633
|
"""
|
202
|
-
return await convert_from(
|
634
|
+
return await convert_from(
|
635
|
+
"pdf",
|
636
|
+
"csv",
|
637
|
+
ConversionParams(
|
638
|
+
url=url,
|
639
|
+
autosize=autosize,
|
640
|
+
httpusername=httpusername,
|
641
|
+
httppassword=httppassword,
|
642
|
+
pages=pages,
|
643
|
+
name=name,
|
644
|
+
api_key=api_key,
|
645
|
+
),
|
646
|
+
)
|
647
|
+
|
203
648
|
|
204
649
|
@mcp.tool()
|
205
650
|
async def image_to_pdf(
|
206
|
-
url: str = Field(
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
651
|
+
url: str = Field(
|
652
|
+
description="URL to the source file (JPG, PNG, TIFF). Multiple files are supported (by providing a comma-separated list of URLs). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
653
|
+
),
|
654
|
+
httpusername: str = Field(
|
655
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
656
|
+
default="",
|
657
|
+
),
|
658
|
+
httppassword: str = Field(
|
659
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
660
|
+
default="",
|
661
|
+
),
|
662
|
+
pages: str = Field(
|
663
|
+
description="Comma-separated page indices (e.g., '0, 1, 2-' or '1, 3-7'). Use '!' for inverted page numbers (e.g., '!0' for last page). Processes all pages if None. (Optional)",
|
664
|
+
default="",
|
665
|
+
),
|
666
|
+
name: str = Field(
|
667
|
+
description="File name for the generated output. (Optional)", default=""
|
668
|
+
),
|
669
|
+
api_key: str = Field(
|
670
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
671
|
+
default=None,
|
672
|
+
),
|
212
673
|
) -> BaseResponse:
|
213
674
|
"""
|
214
675
|
Convert various image formats (JPG, PNG, TIFF) to PDF.
|
215
676
|
Ref: https://developer.pdf.co/api-reference/pdf-from-image.md
|
216
677
|
```
|
217
678
|
"""
|
218
|
-
return await convert_from(
|
679
|
+
return await convert_from(
|
680
|
+
"pdf",
|
681
|
+
"image",
|
682
|
+
ConversionParams(
|
683
|
+
url=url,
|
684
|
+
httpusername=httpusername,
|
685
|
+
httppassword=httppassword,
|
686
|
+
pages=pages,
|
687
|
+
name=name,
|
688
|
+
api_key=api_key,
|
689
|
+
),
|
690
|
+
)
|
691
|
+
|
219
692
|
|
220
693
|
@mcp.tool()
|
221
694
|
async def webpage_to_pdf(
|
222
695
|
url: str = Field(description="URL to the source file (external webpage URL)."),
|
223
|
-
margins: str = Field(
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
696
|
+
margins: str = Field(
|
697
|
+
description="Set to CSS style margins like 10px, 5mm, 5in for all sides or 5px 5px 5px 5px (the order of margins is top, right, bottom, left). (Optional)",
|
698
|
+
default="",
|
699
|
+
),
|
700
|
+
paperSize: str = Field(
|
701
|
+
description="A4 is set by default. Can be Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6 or a custom size. Custom size can be set in px (pixels), mm or in (inches) with width and height separated by space like this: 200 300, 200px 300px, 200mm 300mm, 20cm 30cm or 6in 8in. (Optional)",
|
702
|
+
default="",
|
703
|
+
),
|
704
|
+
orientation: str = Field(
|
705
|
+
description="Set to Portrait or Landscape. Portrait is set by default. (Optional)",
|
706
|
+
default="",
|
707
|
+
),
|
708
|
+
printBackground: bool = Field(
|
709
|
+
description="true by default. Set to false to disable printing of background. (Optional)",
|
710
|
+
default=True,
|
711
|
+
),
|
712
|
+
mediaType: str = Field(
|
713
|
+
description="Uses print by default. Set to screen to convert HTML as it appears in a browser or print to convert as it appears for printing or none to set none as mediaType for CSS styles. (Optional)",
|
714
|
+
default="",
|
715
|
+
),
|
716
|
+
DoNotWaitFullLoad: bool = Field(
|
717
|
+
description="false by default. Set to true to skip waiting for full load (like full video load etc. that may affect the total conversion time). (Optional)",
|
718
|
+
default=False,
|
719
|
+
),
|
720
|
+
header: str = Field(
|
721
|
+
description="User definable HTML for the header to be applied on every page header. (Optional)",
|
722
|
+
default="",
|
723
|
+
),
|
724
|
+
footer: str = Field(
|
725
|
+
description="User definable HTML for the footer to be applied on every page footer. (Optional)",
|
726
|
+
default="",
|
727
|
+
),
|
728
|
+
httpusername: str = Field(
|
729
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
730
|
+
default="",
|
731
|
+
),
|
732
|
+
httppassword: str = Field(
|
733
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
734
|
+
default="",
|
735
|
+
),
|
736
|
+
name: str = Field(
|
737
|
+
description="File name for the generated output. (Optional)", default=""
|
738
|
+
),
|
739
|
+
api_key: str = Field(
|
740
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
741
|
+
default=None,
|
742
|
+
),
|
235
743
|
) -> BaseResponse:
|
236
744
|
"""
|
237
745
|
Convert external webpage URL to PDF.
|
238
746
|
Ref: https://developer.pdf.co/api-reference/pdf-from-url.md
|
239
|
-
|
747
|
+
|
240
748
|
The header and footer parameters can contain valid HTML markup with the following classes used to inject printing values into them:
|
241
749
|
- date: formatted print date
|
242
750
|
- title: document title
|
@@ -248,28 +756,84 @@ async def webpage_to_pdf(
|
|
248
756
|
```html
|
249
757
|
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>
|
250
758
|
"""
|
251
|
-
return await convert_from(
|
759
|
+
return await convert_from(
|
760
|
+
"pdf",
|
761
|
+
"url",
|
762
|
+
ConversionParams(
|
763
|
+
url=url,
|
764
|
+
margins=margins,
|
765
|
+
paperSize=paperSize,
|
766
|
+
orientation=orientation,
|
767
|
+
printBackground=printBackground,
|
768
|
+
mediaType=mediaType,
|
769
|
+
DoNotWaitFullLoad=DoNotWaitFullLoad,
|
770
|
+
header=header,
|
771
|
+
footer=footer,
|
772
|
+
httpusername=httpusername,
|
773
|
+
httppassword=httppassword,
|
774
|
+
name=name,
|
775
|
+
api_key=api_key,
|
776
|
+
),
|
777
|
+
)
|
778
|
+
|
252
779
|
|
253
780
|
@mcp.tool()
|
254
781
|
async def html_to_pdf(
|
255
|
-
html: str = Field(
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
782
|
+
html: str = Field(
|
783
|
+
description="Input HTML code to be converted. To convert the link to a PDF use the /pdf/convert/from/url endpoint instead. If it is a local file, just pass the file content as a string."
|
784
|
+
),
|
785
|
+
margins: str = Field(
|
786
|
+
description="Set to CSS style margins like 10px, 5mm, 5in for all sides or 5px 5px 5px 5px (the order of margins is top, right, bottom, left). (Optional)",
|
787
|
+
default="",
|
788
|
+
),
|
789
|
+
paperSize: str = Field(
|
790
|
+
description="A4 is set by default. Can be Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6 or a custom size. Custom size can be set in px (pixels), mm or in (inches) with width and height separated by space like this: 200 300, 200px 300px, 200mm 300mm, 20cm 30cm or 6in 8in. (Optional)",
|
791
|
+
default="",
|
792
|
+
),
|
793
|
+
orientation: str = Field(
|
794
|
+
description="Set to Portrait or Landscape. Portrait is set by default. (Optional)",
|
795
|
+
default="",
|
796
|
+
),
|
797
|
+
printBackground: bool = Field(
|
798
|
+
description="true by default. Set to false to disable printing of background. (Optional)",
|
799
|
+
default=True,
|
800
|
+
),
|
801
|
+
mediaType: str = Field(
|
802
|
+
description="Uses print by default. Set to screen to convert HTML as it appears in a browser or print to convert as it appears for printing or none to set none as mediaType for CSS styles. (Optional)",
|
803
|
+
default="",
|
804
|
+
),
|
805
|
+
DoNotWaitFullLoad: bool = Field(
|
806
|
+
description="false by default. Set to true to skip waiting for full load (like full video load etc. that may affect the total conversion time). (Optional)",
|
807
|
+
default=False,
|
808
|
+
),
|
809
|
+
header: str = Field(
|
810
|
+
description="User definable HTML for the header to be applied on every page header. (Optional)",
|
811
|
+
default="",
|
812
|
+
),
|
813
|
+
footer: str = Field(
|
814
|
+
description="User definable HTML for the footer to be applied on every page footer. (Optional)",
|
815
|
+
default="",
|
816
|
+
),
|
817
|
+
httpusername: str = Field(
|
818
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
819
|
+
default="",
|
820
|
+
),
|
821
|
+
httppassword: str = Field(
|
822
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
823
|
+
default="",
|
824
|
+
),
|
825
|
+
name: str = Field(
|
826
|
+
description="File name for the generated output. (Optional)", default=""
|
827
|
+
),
|
828
|
+
api_key: str = Field(
|
829
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
830
|
+
default=None,
|
831
|
+
),
|
268
832
|
) -> BaseResponse:
|
269
833
|
"""
|
270
834
|
Convert HTML to PDF.
|
271
835
|
Ref: https://developer.pdf.co/api-reference/pdf-from-html/convert.md
|
272
|
-
|
836
|
+
|
273
837
|
The header and footer parameters can contain valid HTML markup with the following classes used to inject printing values into them:
|
274
838
|
- date: formatted print date
|
275
839
|
- title: document title
|
@@ -281,110 +845,323 @@ async def html_to_pdf(
|
|
281
845
|
```html
|
282
846
|
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>
|
283
847
|
"""
|
284
|
-
return await convert_from(
|
848
|
+
return await convert_from(
|
849
|
+
"pdf",
|
850
|
+
"html",
|
851
|
+
ConversionParams(
|
852
|
+
html=html,
|
853
|
+
margins=margins,
|
854
|
+
paperSize=paperSize,
|
855
|
+
orientation=orientation,
|
856
|
+
printBackground=printBackground,
|
857
|
+
mediaType=mediaType,
|
858
|
+
DoNotWaitFullLoad=DoNotWaitFullLoad,
|
859
|
+
header=header,
|
860
|
+
footer=footer,
|
861
|
+
httpusername=httpusername,
|
862
|
+
httppassword=httppassword,
|
863
|
+
name=name,
|
864
|
+
api_key=api_key,
|
865
|
+
),
|
866
|
+
)
|
867
|
+
|
285
868
|
|
286
869
|
@mcp.tool()
|
287
870
|
async def email_to_pdf(
|
288
|
-
url: str = Field(
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
871
|
+
url: str = Field(
|
872
|
+
description="URL to the source file (MSG, EML). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
873
|
+
),
|
874
|
+
embedAttachments: bool = Field(
|
875
|
+
description="Set to true to automatically embeds all attachments from original input email MSG or EML files into the final output PDF. Set it to false if you don’t want to embed attachments so it will convert only the body of the input email. True by default.",
|
876
|
+
default=True,
|
877
|
+
),
|
878
|
+
convertAttachments: bool = Field(
|
879
|
+
description="Set to false if you don’t want to convert attachments from the original email and want to embed them as original files (as embedded PDF attachments). Converts attachments that are supported by the PDF.co API (DOC, DOCx, HTML, PNG, JPG etc.) into PDF format and then merges into output final PDF. Non-supported file types are added as PDF attachments (Adobe Reader or another viewer may be required to view PDF attachments).",
|
880
|
+
default=True,
|
881
|
+
),
|
882
|
+
margins: str = Field(
|
883
|
+
description="Set to CSS style margins like 10px, 5mm, 5in for all sides or 5px 5px 5px 5px (the order of margins is top, right, bottom, left). (Optional)",
|
884
|
+
default="",
|
885
|
+
),
|
886
|
+
paperSize: str = Field(
|
887
|
+
description="A4 is set by default. Can be Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6 or a custom size. Custom size can be set in px (pixels), mm or in (inches) with width and height separated by space like this: 200 300, 200px 300px, 200mm 300mm, 20cm 30cm or 6in 8in. (Optional)",
|
888
|
+
default="",
|
889
|
+
),
|
890
|
+
orientation: str = Field(
|
891
|
+
description="Set to Portrait or Landscape. Portrait is set by default. (Optional)",
|
892
|
+
default="",
|
893
|
+
),
|
894
|
+
api_key: str = Field(
|
895
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
896
|
+
default=None,
|
897
|
+
),
|
295
898
|
) -> BaseResponse:
|
296
899
|
"""
|
297
900
|
Convert email to PDF.
|
298
901
|
Ref: https://developer.pdf.co/api-reference/pdf-from-email.md
|
299
902
|
"""
|
300
|
-
return await convert_from(
|
301
|
-
|
903
|
+
return await convert_from(
|
904
|
+
"pdf",
|
905
|
+
"email",
|
906
|
+
ConversionParams(
|
907
|
+
url=url,
|
908
|
+
embedAttachments=embedAttachments,
|
909
|
+
convertAttachments=convertAttachments,
|
910
|
+
margins=margins,
|
911
|
+
paperSize=paperSize,
|
912
|
+
orientation=orientation,
|
913
|
+
api_key=api_key,
|
914
|
+
),
|
915
|
+
)
|
916
|
+
|
917
|
+
|
302
918
|
@mcp.tool()
|
303
919
|
async def excel_to_csv(
|
304
|
-
url: str = Field(
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
920
|
+
url: str = Field(
|
921
|
+
description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
922
|
+
),
|
923
|
+
httpusername: str = Field(
|
924
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
925
|
+
default="",
|
926
|
+
),
|
927
|
+
httppassword: str = Field(
|
928
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
929
|
+
default="",
|
930
|
+
),
|
931
|
+
name: str = Field(
|
932
|
+
description="File name for the generated output. (Optional)", default=""
|
933
|
+
),
|
934
|
+
worksheetIndex: str = Field(
|
935
|
+
description="Index of the worksheet to convert. (Optional)", default=""
|
936
|
+
),
|
937
|
+
api_key: str = Field(
|
938
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
939
|
+
default=None,
|
940
|
+
),
|
310
941
|
) -> BaseResponse:
|
311
942
|
"""
|
312
943
|
Convert Excel(XLS, XLSX) to CSV.
|
313
944
|
Ref: https://developer.pdf.co/api-reference/convert-from-excel/csv.md
|
314
945
|
"""
|
315
|
-
return await convert_to(
|
946
|
+
return await convert_to(
|
947
|
+
"xls",
|
948
|
+
"csv",
|
949
|
+
ConversionParams(
|
950
|
+
url=url,
|
951
|
+
httpusername=httpusername,
|
952
|
+
httppassword=httppassword,
|
953
|
+
name=name,
|
954
|
+
worksheetIndex=worksheetIndex,
|
955
|
+
api_key=api_key,
|
956
|
+
),
|
957
|
+
)
|
958
|
+
|
316
959
|
|
317
960
|
@mcp.tool()
|
318
961
|
async def excel_to_json(
|
319
|
-
url: str = Field(
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
962
|
+
url: str = Field(
|
963
|
+
description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
964
|
+
),
|
965
|
+
httpusername: str = Field(
|
966
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
967
|
+
default="",
|
968
|
+
),
|
969
|
+
httppassword: str = Field(
|
970
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
971
|
+
default="",
|
972
|
+
),
|
973
|
+
name: str = Field(
|
974
|
+
description="File name for the generated output. (Optional)", default=""
|
975
|
+
),
|
976
|
+
worksheetIndex: str = Field(
|
977
|
+
description="Index of the worksheet to convert. (Optional)", default=""
|
978
|
+
),
|
979
|
+
api_key: str = Field(
|
980
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
981
|
+
default=None,
|
982
|
+
),
|
325
983
|
) -> BaseResponse:
|
326
984
|
"""
|
327
985
|
Convert Excel(XLS, XLSX) to JSON.
|
328
986
|
Ref: https://developer.pdf.co/api-reference/convert-from-excel/json.md
|
329
987
|
"""
|
330
|
-
return await convert_to(
|
988
|
+
return await convert_to(
|
989
|
+
"xls",
|
990
|
+
"json",
|
991
|
+
ConversionParams(
|
992
|
+
url=url,
|
993
|
+
httpusername=httpusername,
|
994
|
+
httppassword=httppassword,
|
995
|
+
name=name,
|
996
|
+
worksheetIndex=worksheetIndex,
|
997
|
+
api_key=api_key,
|
998
|
+
),
|
999
|
+
)
|
1000
|
+
|
331
1001
|
|
332
1002
|
@mcp.tool()
|
333
1003
|
async def excel_to_html(
|
334
|
-
url: str = Field(
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
1004
|
+
url: str = Field(
|
1005
|
+
description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
1006
|
+
),
|
1007
|
+
httpusername: str = Field(
|
1008
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
1009
|
+
default="",
|
1010
|
+
),
|
1011
|
+
httppassword: str = Field(
|
1012
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
1013
|
+
default="",
|
1014
|
+
),
|
1015
|
+
name: str = Field(
|
1016
|
+
description="File name for the generated output. (Optional)", default=""
|
1017
|
+
),
|
1018
|
+
worksheetIndex: str = Field(
|
1019
|
+
description="Index of the worksheet to convert. (Optional)", default=""
|
1020
|
+
),
|
1021
|
+
api_key: str = Field(
|
1022
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
1023
|
+
default=None,
|
1024
|
+
),
|
340
1025
|
) -> BaseResponse:
|
341
1026
|
"""
|
342
1027
|
Convert Excel(XLS, XLSX) to HTML.
|
343
1028
|
Ref: https://developer.pdf.co/api-reference/convert-from-excel/html.md
|
344
1029
|
"""
|
345
|
-
return await convert_to(
|
1030
|
+
return await convert_to(
|
1031
|
+
"xls",
|
1032
|
+
"html",
|
1033
|
+
ConversionParams(
|
1034
|
+
url=url,
|
1035
|
+
httpusername=httpusername,
|
1036
|
+
httppassword=httppassword,
|
1037
|
+
name=name,
|
1038
|
+
worksheetIndex=worksheetIndex,
|
1039
|
+
api_key=api_key,
|
1040
|
+
),
|
1041
|
+
)
|
1042
|
+
|
346
1043
|
|
347
1044
|
@mcp.tool()
|
348
1045
|
async def excel_to_txt(
|
349
|
-
url: str = Field(
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
1046
|
+
url: str = Field(
|
1047
|
+
description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
1048
|
+
),
|
1049
|
+
httpusername: str = Field(
|
1050
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
1051
|
+
default="",
|
1052
|
+
),
|
1053
|
+
httppassword: str = Field(
|
1054
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
1055
|
+
default="",
|
1056
|
+
),
|
1057
|
+
name: str = Field(
|
1058
|
+
description="File name for the generated output. (Optional)", default=""
|
1059
|
+
),
|
1060
|
+
worksheetIndex: str = Field(
|
1061
|
+
description="Index of the worksheet to convert. (Optional)", default=""
|
1062
|
+
),
|
1063
|
+
api_key: str = Field(
|
1064
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
1065
|
+
default=None,
|
1066
|
+
),
|
355
1067
|
) -> BaseResponse:
|
356
1068
|
"""
|
357
1069
|
Convert Excel(XLS, XLSX) to TXT.
|
358
1070
|
Ref: https://developer.pdf.co/api-reference/convert-from-excel/text.md
|
359
1071
|
"""
|
360
|
-
return await convert_to(
|
1072
|
+
return await convert_to(
|
1073
|
+
"xls",
|
1074
|
+
"txt",
|
1075
|
+
ConversionParams(
|
1076
|
+
url=url,
|
1077
|
+
httpusername=httpusername,
|
1078
|
+
httppassword=httppassword,
|
1079
|
+
name=name,
|
1080
|
+
worksheetIndex=worksheetIndex,
|
1081
|
+
api_key=api_key,
|
1082
|
+
),
|
1083
|
+
)
|
1084
|
+
|
361
1085
|
|
362
1086
|
@mcp.tool()
|
363
1087
|
async def excel_to_xml(
|
364
|
-
url: str = Field(
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
1088
|
+
url: str = Field(
|
1089
|
+
description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
1090
|
+
),
|
1091
|
+
httpusername: str = Field(
|
1092
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
1093
|
+
default="",
|
1094
|
+
),
|
1095
|
+
httppassword: str = Field(
|
1096
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
1097
|
+
default="",
|
1098
|
+
),
|
1099
|
+
name: str = Field(
|
1100
|
+
description="File name for the generated output. (Optional)", default=""
|
1101
|
+
),
|
1102
|
+
worksheetIndex: str = Field(
|
1103
|
+
description="Index of the worksheet to convert. (Optional)", default=""
|
1104
|
+
),
|
1105
|
+
api_key: str = Field(
|
1106
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
1107
|
+
default=None,
|
1108
|
+
),
|
370
1109
|
) -> BaseResponse:
|
371
1110
|
"""
|
372
1111
|
Convert Excel(XLS, XLSX) to XML.
|
373
1112
|
Ref: https://developer.pdf.co/api-reference/convert-from-excel/xml.md
|
374
1113
|
"""
|
375
|
-
return await convert_to(
|
1114
|
+
return await convert_to(
|
1115
|
+
"xls",
|
1116
|
+
"xml",
|
1117
|
+
ConversionParams(
|
1118
|
+
url=url,
|
1119
|
+
httpusername=httpusername,
|
1120
|
+
httppassword=httppassword,
|
1121
|
+
name=name,
|
1122
|
+
worksheetIndex=worksheetIndex,
|
1123
|
+
api_key=api_key,
|
1124
|
+
),
|
1125
|
+
)
|
1126
|
+
|
376
1127
|
|
377
1128
|
@mcp.tool()
|
378
1129
|
async def excel_to_pdf(
|
379
|
-
url: str = Field(
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
1130
|
+
url: str = Field(
|
1131
|
+
description="URL to the source file (XLS, XLSX). Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files."
|
1132
|
+
),
|
1133
|
+
httpusername: str = Field(
|
1134
|
+
description="HTTP auth user name if required to access source url. (Optional)",
|
1135
|
+
default="",
|
1136
|
+
),
|
1137
|
+
httppassword: str = Field(
|
1138
|
+
description="HTTP auth password if required to access source url. (Optional)",
|
1139
|
+
default="",
|
1140
|
+
),
|
1141
|
+
name: str = Field(
|
1142
|
+
description="File name for the generated output. (Optional)", default=""
|
1143
|
+
),
|
1144
|
+
worksheetIndex: str = Field(
|
1145
|
+
description="Index of the worksheet to convert. (Optional)", default=""
|
1146
|
+
),
|
1147
|
+
api_key: str = Field(
|
1148
|
+
description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
|
1149
|
+
default=None,
|
1150
|
+
),
|
385
1151
|
) -> BaseResponse:
|
386
1152
|
"""
|
387
1153
|
Convert Excel(XLS, XLSX) to PDF.
|
388
1154
|
Ref: https://developer.pdf.co/api-reference/convert-from-excel/pdf.md
|
389
1155
|
"""
|
390
|
-
return await convert_to(
|
1156
|
+
return await convert_to(
|
1157
|
+
"xls",
|
1158
|
+
"pdf",
|
1159
|
+
ConversionParams(
|
1160
|
+
url=url,
|
1161
|
+
httpusername=httpusername,
|
1162
|
+
httppassword=httppassword,
|
1163
|
+
name=name,
|
1164
|
+
worksheetIndex=worksheetIndex,
|
1165
|
+
api_key=api_key,
|
1166
|
+
),
|
1167
|
+
)
|