lightpdf-aipdf-mcp 0.1.58__py3-none-any.whl → 0.1.59__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.
@@ -139,6 +139,17 @@ async def process_conversion_file(
139
139
  original_name
140
140
  )
141
141
  else:
142
+ # 处理extra_params
143
+ if extra_params is None:
144
+ extra_params = {}
145
+
146
+ # 处理is_long_image参数,如果需要转换为长图,则添加merge_all=1参数
147
+ if extra_params.get("is_long_image") and format in ["jpg", "jpeg", "png"]:
148
+ extra_params["merge_all"] = 1
149
+ # 从extra_params中移除is_long_image,因为API不需要这个参数
150
+ if "is_long_image" in extra_params:
151
+ del extra_params["is_long_image"]
152
+
142
153
  # 对于其他操作,使用convert_file方法
143
154
  return await converter.convert_file(file_path, format, extra_params, password, original_name)
144
155
 
@@ -345,7 +356,7 @@ async def handle_list_tools() -> list[types.Tool]:
345
356
  return [
346
357
  types.Tool(
347
358
  name="convert_document",
348
- description="文档格式转换工具。\n\nPDF可转换为:DOCX/XLSX/PPTX/图片/HTML/TXT;\n其他格式可转换为PDF:DOCX/XLSX/PPTX/图片/CAD/CAJ/OFD",
359
+ description="文档格式转换工具。\n\nPDF可转换为:DOCX/XLSX/PPTX/图片(长图)/HTML/TXT;\n其他格式可转换为PDF:DOCX/XLSX/PPTX/图片/CAD/CAJ/OFD",
349
360
  inputSchema={
350
361
  "type": "object",
351
362
  "properties": {
@@ -375,6 +386,11 @@ async def handle_list_tools() -> list[types.Tool]:
375
386
  "type": "string",
376
387
  "description": "目标格式",
377
388
  "enum": ["pdf", "docx", "xlsx", "pptx", "jpg", "jpeg", "png", "html", "txt"]
389
+ },
390
+ "is_long_image": {
391
+ "type": "boolean",
392
+ "description": "是否需要转换为长图。仅当format为jpg/jpeg/png时有效",
393
+ "default": False
378
394
  }
379
395
  },
380
396
  "required": ["files", "format"]
@@ -776,7 +792,7 @@ async def handle_list_tools() -> list[types.Tool]:
776
792
  ),
777
793
  types.Tool(
778
794
  name="remove_margin",
779
- description="去除PDF文件的白边(页边距)。",
795
+ description="去除PDF文件的白边(裁剪去掉页面边距)。",
780
796
  inputSchema={
781
797
  "type": "object",
782
798
  "properties": {
@@ -932,6 +948,12 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
932
948
  if name == "protect_pdf" and "password" in arguments:
933
949
  operation_config["extra_params"]["password"] = arguments.get("password")
934
950
 
951
+ # 处理convert_document工具的is_long_image参数
952
+ if name == "convert_document" and "is_long_image" in arguments:
953
+ if operation_config.get("extra_params") is None:
954
+ operation_config["extra_params"] = {}
955
+ operation_config["extra_params"]["is_long_image"] = arguments.get("is_long_image", False)
956
+
935
957
  # 特殊处理merge_pdfs工具
936
958
  if name == "merge_pdfs":
937
959
  # 创建编辑器
@@ -1058,4 +1080,4 @@ def cli_main():
1058
1080
  sys.exit(1)
1059
1081
 
1060
1082
  if __name__ == "__main__":
1061
- cli_main()
1083
+ cli_main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lightpdf-aipdf-mcp
3
- Version: 0.1.58
3
+ Version: 0.1.59
4
4
  Summary: MCP Server for LightPDF AI-PDF
5
5
  Author: LightPDF Team
6
6
  License: Proprietary
@@ -2,8 +2,8 @@ lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6
2
2
  lightpdf_aipdf_mcp/common.py,sha256=-7LU6gm-As_F8Ly68ssy15Vc9Zt_eNSnvDLEtVZDwlI,6633
3
3
  lightpdf_aipdf_mcp/converter.py,sha256=d90pNUT8pQn93u1fJSlu4f2KyLDzhOdTrqyBkSTRFBE,14450
4
4
  lightpdf_aipdf_mcp/editor.py,sha256=fGzIiAp48uTXBBKWWlHcGT0nwgZQBpjvrsxSf6Ockk4,24730
5
- lightpdf_aipdf_mcp/server.py,sha256=E9F2aE52R2ZPdLyFdZJ02-dXrmE_VpAHk64J6qSd8KI,43447
6
- lightpdf_aipdf_mcp-0.1.58.dist-info/METADATA,sha256=EyhD4kqvzK_a8S1fjB2_9r37U4dmAXcXlQizuYbXs3k,7826
7
- lightpdf_aipdf_mcp-0.1.58.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- lightpdf_aipdf_mcp-0.1.58.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
9
- lightpdf_aipdf_mcp-0.1.58.dist-info/RECORD,,
5
+ lightpdf_aipdf_mcp/server.py,sha256=0FcdFUQLdINscScE8_tDeA41hC1TqvJWoNcfLhxqTfo,44612
6
+ lightpdf_aipdf_mcp-0.1.59.dist-info/METADATA,sha256=syXcd6G9JRqGJAqWvKfVad6VnVI1dWfkxzJxZDQBB4U,7826
7
+ lightpdf_aipdf_mcp-0.1.59.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ lightpdf_aipdf_mcp-0.1.59.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
9
+ lightpdf_aipdf_mcp-0.1.59.dist-info/RECORD,,