lightpdf-aipdf-mcp 0.1.118__py3-none-any.whl → 0.1.119__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/editor.py +6 -5
- lightpdf_aipdf_mcp/server.py +6 -5
- {lightpdf_aipdf_mcp-0.1.118.dist-info → lightpdf_aipdf_mcp-0.1.119.dist-info}/METADATA +1 -1
- {lightpdf_aipdf_mcp-0.1.118.dist-info → lightpdf_aipdf_mcp-0.1.119.dist-info}/RECORD +6 -6
- {lightpdf_aipdf_mcp-0.1.118.dist-info → lightpdf_aipdf_mcp-0.1.119.dist-info}/WHEEL +0 -0
- {lightpdf_aipdf_mcp-0.1.118.dist-info → lightpdf_aipdf_mcp-0.1.119.dist-info}/entry_points.txt +0 -0
lightpdf_aipdf_mcp/editor.py
CHANGED
@@ -73,7 +73,7 @@ class Editor(BaseApiClient):
|
|
73
73
|
file_path: 要拆分的PDF文件路径
|
74
74
|
pages: 拆分页面规则,例如 "1,3,5-7" 表示提取第1,3,5,6,7页,""表示所有页面,默认为""
|
75
75
|
password: 文档密码,如果文档受密码保护,则需要提供(可选)
|
76
|
-
split_type: 拆分类型,可选值: "every"=每页拆分为一个文件, "page"
|
76
|
+
split_type: 拆分类型,可选值: "every"=每页拆分为一个文件, "page"=指定页面规则拆分,"outline"=按书签/大纲/目录节点拆分,默认为"page"
|
77
77
|
merge_all: 是否合并拆分后的文件,仅在split_type="page"时有效,0=不合并,1=合并,默认为1
|
78
78
|
original_name: 原始文件名(可选)
|
79
79
|
|
@@ -85,10 +85,10 @@ class Editor(BaseApiClient):
|
|
85
85
|
return EditResult(success=False, file_path=file_path, error_message="非PDF文件", original_name=original_name)
|
86
86
|
|
87
87
|
# 验证拆分类型
|
88
|
-
valid_split_types = {"every", "page"}
|
88
|
+
valid_split_types = {"every", "page", "outline"}
|
89
89
|
if split_type not in valid_split_types:
|
90
|
-
await self.logger.error(f"无效的拆分类型: {split_type}。有效值为: every, page")
|
91
|
-
return EditResult(success=False, file_path=file_path, error_message=f"无效的拆分类型: {split_type}。有效值为: every, page", original_name=original_name)
|
90
|
+
await self.logger.error(f"无效的拆分类型: {split_type}。有效值为: every, page, outline")
|
91
|
+
return EditResult(success=False, file_path=file_path, error_message=f"无效的拆分类型: {split_type}。有效值为: every, page, outline", original_name=original_name)
|
92
92
|
|
93
93
|
# 构建API参数
|
94
94
|
extra_params = {
|
@@ -99,7 +99,8 @@ class Editor(BaseApiClient):
|
|
99
99
|
if split_type == "page":
|
100
100
|
extra_params["pages"] = pages
|
101
101
|
extra_params["merge_all"] = merge_all
|
102
|
-
|
102
|
+
# outline模式无需pages和merge_all
|
103
|
+
|
103
104
|
# 记录操作描述
|
104
105
|
operation_details = f"类型: {split_type}"
|
105
106
|
if split_type == "page":
|
lightpdf_aipdf_mcp/server.py
CHANGED
@@ -196,6 +196,7 @@ async def process_edit_file(
|
|
196
196
|
original_name=original_name
|
197
197
|
)
|
198
198
|
elif edit_type == "split":
|
199
|
+
# 支持split_type: every(每页)、page(按页范围)、outline(按书签/大纲/目录)
|
199
200
|
return await editor.split_pdf(
|
200
201
|
file_path=file_path,
|
201
202
|
pages=extra_params.get("pages", ""),
|
@@ -792,7 +793,7 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
792
793
|
),
|
793
794
|
types.Tool(
|
794
795
|
name="split_pdf",
|
795
|
-
description="Split PDF documents by pages.
|
796
|
+
description="Split PDF documents by pages. You can split each page into a separate PDF file, split by specified page ranges, or split by outline/bookmarks/table of contents (outline). Split files can be multiple independent PDF files (returned as a zip package) or merged into a single PDF file.",
|
796
797
|
inputSchema={
|
797
798
|
"type": "object",
|
798
799
|
"properties": {
|
@@ -820,17 +821,17 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
820
821
|
},
|
821
822
|
"split_type": {
|
822
823
|
"type": "string",
|
823
|
-
"description": "Split type: split each page into a separate file
|
824
|
-
"enum": ["every", "page"],
|
824
|
+
"description": "Split type: 'every' (split each page into a separate file), 'page' (split by page ranges), or 'outline' (split by PDF outline/bookmarks/table of contents, each node as a separate PDF file).",
|
825
|
+
"enum": ["every", "page", "outline"],
|
825
826
|
"default": "page"
|
826
827
|
},
|
827
828
|
"pages": {
|
828
829
|
"type": "string",
|
829
|
-
"description": "Specify page ranges to split, e.g. '1,3,5-7' or '' (empty string or not set) for all pages. Only valid when split_type is page"
|
830
|
+
"description": "Specify page ranges to split, e.g. '1,3,5-7' or '' (empty string or not set) for all pages. Only valid when split_type is 'page'."
|
830
831
|
},
|
831
832
|
"merge_all": {
|
832
833
|
"type": "integer",
|
833
|
-
"description": "Whether to merge results into a single PDF file: 1=yes, 0=no (will return a zip package of multiple files). Only valid when split_type is page",
|
834
|
+
"description": "Whether to merge results into a single PDF file: 1=yes, 0=no (will return a zip package of multiple files). Only valid when split_type is 'page'.",
|
834
835
|
"enum": [0, 1],
|
835
836
|
"default": 0
|
836
837
|
}
|
@@ -2,10 +2,10 @@ lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6
|
|
2
2
|
lightpdf_aipdf_mcp/common.py,sha256=PhTf7Zg6mEgn1rTmJDHotXp-4xb2gWFf-Dy_t25qNdY,6660
|
3
3
|
lightpdf_aipdf_mcp/converter.py,sha256=vAFB6XtDFt9NPS9yygKBuL4t43nZU--RqqKPC06Mvkg,16761
|
4
4
|
lightpdf_aipdf_mcp/create_pdf.py,sha256=oALIhOBo60D3Gu_li7d7FF0COhFfSTM-BJpc63r9iAs,2465
|
5
|
-
lightpdf_aipdf_mcp/editor.py,sha256=
|
6
|
-
lightpdf_aipdf_mcp/server.py,sha256=
|
5
|
+
lightpdf_aipdf_mcp/editor.py,sha256=AufKgyUOMYz79_ZUFcXS-SoI6wTCrmNrq_he3EfzgHA,30120
|
6
|
+
lightpdf_aipdf_mcp/server.py,sha256=trLQxJd7sNYD4bbXqxnO38PBNcqdGi1Rb-HGb_eeqL0,65761
|
7
7
|
lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
|
8
|
-
lightpdf_aipdf_mcp-0.1.
|
9
|
-
lightpdf_aipdf_mcp-0.1.
|
10
|
-
lightpdf_aipdf_mcp-0.1.
|
11
|
-
lightpdf_aipdf_mcp-0.1.
|
8
|
+
lightpdf_aipdf_mcp-0.1.119.dist-info/METADATA,sha256=jsautgDFQ-c1V3Kig_ZqwLW4_NdcbTrjhMwBQPoJHuU,8120
|
9
|
+
lightpdf_aipdf_mcp-0.1.119.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
lightpdf_aipdf_mcp-0.1.119.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
|
11
|
+
lightpdf_aipdf_mcp-0.1.119.dist-info/RECORD,,
|
File without changes
|
{lightpdf_aipdf_mcp-0.1.118.dist-info → lightpdf_aipdf_mcp-0.1.119.dist-info}/entry_points.txt
RENAMED
File without changes
|