lightpdf-aipdf-mcp 0.1.88__py3-none-any.whl → 0.1.89__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.
- lightpdf_aipdf_mcp/server.py +48 -1
- lightpdf_aipdf_mcp/translator.py +7 -0
- {lightpdf_aipdf_mcp-0.1.88.dist-info → lightpdf_aipdf_mcp-0.1.89.dist-info}/METADATA +1 -1
- lightpdf_aipdf_mcp-0.1.89.dist-info/RECORD +10 -0
- lightpdf_aipdf_mcp-0.1.88.dist-info/RECORD +0 -10
- {lightpdf_aipdf_mcp-0.1.88.dist-info → lightpdf_aipdf_mcp-0.1.89.dist-info}/WHEEL +0 -0
- {lightpdf_aipdf_mcp-0.1.88.dist-info → lightpdf_aipdf_mcp-0.1.89.dist-info}/entry_points.txt +0 -0
lightpdf_aipdf_mcp/server.py
CHANGED
@@ -1096,6 +1096,46 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
1096
1096
|
"required": ["files", "target"]
|
1097
1097
|
}
|
1098
1098
|
),
|
1099
|
+
types.Tool(
|
1100
|
+
name="resize-pdf",
|
1101
|
+
description="Resize PDF pages. You can specify the target page size (a0/a1/a2/a3/a4/a5/a6/letter) and/or the image resolution (dpi, e.g., 72). If not set, the corresponding property will not be changed.",
|
1102
|
+
inputSchema={
|
1103
|
+
"type": "object",
|
1104
|
+
"properties": {
|
1105
|
+
"files": {
|
1106
|
+
"type": "array",
|
1107
|
+
"items": {
|
1108
|
+
"type": "object",
|
1109
|
+
"properties": {
|
1110
|
+
"path": {
|
1111
|
+
"type": "string",
|
1112
|
+
"description": "PDF file URL to resize, must include protocol, supports http/https/oss"
|
1113
|
+
},
|
1114
|
+
"password": {
|
1115
|
+
"type": "string",
|
1116
|
+
"description": "PDF document password, required if the document is password-protected"
|
1117
|
+
},
|
1118
|
+
"name": {
|
1119
|
+
"type": "string",
|
1120
|
+
"description": "Original filename of the document"
|
1121
|
+
}
|
1122
|
+
},
|
1123
|
+
"required": ["path"]
|
1124
|
+
},
|
1125
|
+
"description": "List of PDF files to resize, each containing path and optional password"
|
1126
|
+
},
|
1127
|
+
"page_size": {
|
1128
|
+
"type": "string",
|
1129
|
+
"description": "Target page size. Any valid page size name is supported (e.g., a4, letter, legal, etc.), or use width,height in points (pt, e.g., 595,842). If not set, page size will not be changed."
|
1130
|
+
},
|
1131
|
+
"resolution": {
|
1132
|
+
"type": "integer",
|
1133
|
+
"description": "Image resolution (dpi), e.g., 72. If not set, resolution will not be changed."
|
1134
|
+
}
|
1135
|
+
},
|
1136
|
+
"required": ["files"]
|
1137
|
+
}
|
1138
|
+
),
|
1099
1139
|
]
|
1100
1140
|
|
1101
1141
|
@app.call_tool()
|
@@ -1122,6 +1162,11 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
|
|
1122
1162
|
"format": "flatten-pdf", # 固定format
|
1123
1163
|
"is_edit_operation": False
|
1124
1164
|
},
|
1165
|
+
"resize-pdf": {
|
1166
|
+
"format": "resize-pdf",
|
1167
|
+
"is_edit_operation": False,
|
1168
|
+
"param_keys": ["page_size", "resolution"]
|
1169
|
+
},
|
1125
1170
|
"unlock_pdf": {
|
1126
1171
|
"edit_type": "decrypt", # 编辑类型
|
1127
1172
|
"is_edit_operation": True, # 标记为编辑操作
|
@@ -1194,7 +1239,9 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
|
|
1194
1239
|
"merge_all": 1,
|
1195
1240
|
"angle": 90,
|
1196
1241
|
"pages": "all", # 更新默认值为"all"
|
1197
|
-
"format": "png" # 提取图片的默认格式
|
1242
|
+
"format": "png", # 提取图片的默认格式
|
1243
|
+
"page_size": "",
|
1244
|
+
"resolution": 0,
|
1198
1245
|
}
|
1199
1246
|
|
1200
1247
|
if name in TOOL_CONFIG:
|
lightpdf_aipdf_mcp/translator.py
CHANGED
@@ -75,6 +75,13 @@ class Translator(BaseApiClient):
|
|
75
75
|
headers=headers
|
76
76
|
)
|
77
77
|
elif self.file_handler.is_url(file_path):
|
78
|
+
# arxiv.org/pdf/特殊处理
|
79
|
+
if isinstance(file_path, str) and "arxiv.org/pdf/" in file_path:
|
80
|
+
from urllib.parse import urlparse, urlunparse
|
81
|
+
url_obj = urlparse(file_path)
|
82
|
+
if not url_obj.path.endswith(".pdf"):
|
83
|
+
new_path = url_obj.path + ".pdf"
|
84
|
+
file_path = urlunparse(url_obj._replace(path=new_path))
|
78
85
|
data["url"] = file_path
|
79
86
|
headers["Content-Type"] = "application/json"
|
80
87
|
response = await client.post(
|
@@ -0,0 +1,10 @@
|
|
1
|
+
lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
|
2
|
+
lightpdf_aipdf_mcp/common.py,sha256=_UO1f6S9Qr_3k6u5iBpdVDpvTK5U-tHEpu9KsDGqV8Y,6635
|
3
|
+
lightpdf_aipdf_mcp/converter.py,sha256=f0gS8tAQlJ8uwJUVUmd9nAA4O9m558e9lAT2B_MxmIo,15135
|
4
|
+
lightpdf_aipdf_mcp/editor.py,sha256=9teOqi2y2JbjcCI-kUhYpSXL-F75i7Mfr9E20KKyZP0,29909
|
5
|
+
lightpdf_aipdf_mcp/server.py,sha256=uLb_gOB1uP6eN53BDMp2qLXQk_9GjKJjYJDSjb75iyo,62324
|
6
|
+
lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
|
7
|
+
lightpdf_aipdf_mcp-0.1.89.dist-info/METADATA,sha256=O87D9f3cGiHt0FbLwdDLb_s5jD-v6c4MBK7X7HbAkkI,8119
|
8
|
+
lightpdf_aipdf_mcp-0.1.89.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
lightpdf_aipdf_mcp-0.1.89.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
|
10
|
+
lightpdf_aipdf_mcp-0.1.89.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
|
2
|
-
lightpdf_aipdf_mcp/common.py,sha256=_UO1f6S9Qr_3k6u5iBpdVDpvTK5U-tHEpu9KsDGqV8Y,6635
|
3
|
-
lightpdf_aipdf_mcp/converter.py,sha256=f0gS8tAQlJ8uwJUVUmd9nAA4O9m558e9lAT2B_MxmIo,15135
|
4
|
-
lightpdf_aipdf_mcp/editor.py,sha256=9teOqi2y2JbjcCI-kUhYpSXL-F75i7Mfr9E20KKyZP0,29909
|
5
|
-
lightpdf_aipdf_mcp/server.py,sha256=khv6gJNWx8nhH6gpOu4jdeeL8p7xMPONEv7mAf8oWXQ,59952
|
6
|
-
lightpdf_aipdf_mcp/translator.py,sha256=FACnFcnz1zNDdndR3tAgTfDDkfk1rJRRgWorFbiiEUk,3834
|
7
|
-
lightpdf_aipdf_mcp-0.1.88.dist-info/METADATA,sha256=AOlJAa2HvSrrcN2I264tvQ5FR3-Gl4Nz7jqo1Ai4Wjs,8119
|
8
|
-
lightpdf_aipdf_mcp-0.1.88.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
lightpdf_aipdf_mcp-0.1.88.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
|
10
|
-
lightpdf_aipdf_mcp-0.1.88.dist-info/RECORD,,
|
File without changes
|
{lightpdf_aipdf_mcp-0.1.88.dist-info → lightpdf_aipdf_mcp-0.1.89.dist-info}/entry_points.txt
RENAMED
File without changes
|