lightpdf-aipdf-mcp 0.1.100__py3-none-any.whl → 0.1.101__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.
@@ -5,7 +5,7 @@ import uuid
5
5
  from .common import Logger, FileHandler
6
6
  from .editor import Editor, EditResult, EditType
7
7
 
8
- async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] = None, logger: Optional[Logger] = None):
8
+ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] = None, logger: Optional[Logger] = None, original_name: Optional[str] = None):
9
9
  """
10
10
  根据LaTeX内容创建PDF文件。
11
11
 
@@ -13,6 +13,7 @@ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] =
13
13
  latex_content (str): LaTeX源内容。
14
14
  output_path (Optional[str]): 可选,输出PDF文件路径。
15
15
  logger (Optional[Logger]): 日志对象。
16
+ original_name (Optional[str]): 可选,原始文件名。
16
17
  返回:
17
18
  dict: 包含生成结果的信息(如成功与否、PDF路径、错误信息等)。
18
19
  """
@@ -40,8 +41,8 @@ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] =
40
41
  # extra_params按txt转pdf方式
41
42
  extra_params = {"pages": '[{"url": "oss://tex2pdf", "oss_file": ""}]'}
42
43
 
43
- # 这里original_name可用tex_filename
44
- result: EditResult = await editor.edit_pdf(tex_path, edit_type=EditType.EDIT, extra_params=extra_params, original_name=tex_filename)
44
+ # original_name优先用传入的参数,否则用tex_filename
45
+ result: EditResult = await editor.edit_pdf(tex_path, edit_type=EditType.EDIT, extra_params=extra_params, original_name=original_name or tex_filename)
45
46
  # 3. 返回结果
46
47
  return result
47
48
  except Exception as e:
@@ -1149,9 +1149,13 @@ async def handle_list_tools() -> list[types.Tool]:
1149
1149
  "latex_content": {
1150
1150
  "type": "string",
1151
1151
  "description": "The LaTeX source content to be compiled into a PDF file."
1152
+ },
1153
+ "filename": {
1154
+ "type": "string",
1155
+ "description": "The filename for the generated PDF"
1152
1156
  }
1153
1157
  },
1154
- "required": ["latex_content"]
1158
+ "required": ["latex_content", "filename"]
1155
1159
  }
1156
1160
  ),
1157
1161
  ]
@@ -1359,13 +1363,17 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
1359
1363
  elif name == "create_pdf":
1360
1364
  from .create_pdf import create_pdf_from_latex
1361
1365
  latex_content = arguments.get("latex_content")
1366
+ filename = arguments.get("filename")
1362
1367
  if not latex_content:
1363
1368
  error_msg = "latex_content参数不能为空"
1364
1369
  await logger.error(error_msg)
1365
1370
  return [types.TextContent(type="text", text=error_msg)]
1371
+ if not filename:
1372
+ error_msg = "filename参数不能为空"
1373
+ await logger.error(error_msg)
1374
+ return [types.TextContent(type="text", text=error_msg)]
1366
1375
 
1367
- # 调用create_pdf_from_latex接口(未实现具体逻辑)
1368
- result = await create_pdf_from_latex(latex_content, logger=logger)
1376
+ result = await create_pdf_from_latex(latex_content, logger=logger, original_name=filename)
1369
1377
  # 构建结果报告
1370
1378
  report_msg = generate_result_report(
1371
1379
  [result]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lightpdf-aipdf-mcp
3
- Version: 0.1.100
3
+ Version: 0.1.101
4
4
  Summary: MCP Server for LightPDF AI-PDF
5
5
  Author: LightPDF Team
6
6
  License: Proprietary
@@ -1,11 +1,11 @@
1
1
  lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
2
2
  lightpdf_aipdf_mcp/common.py,sha256=PhTf7Zg6mEgn1rTmJDHotXp-4xb2gWFf-Dy_t25qNdY,6660
3
3
  lightpdf_aipdf_mcp/converter.py,sha256=Q_4vXcysqcJ7w6bUKY9JhoBDlCRcAJSpW7p0jh5qekU,16120
4
- lightpdf_aipdf_mcp/create_pdf.py,sha256=SULJRKFghbQy7VP9GPxS6auy5nMxBN61SxgDr-Wr_lA,2120
4
+ lightpdf_aipdf_mcp/create_pdf.py,sha256=jKyzObP3Mj55yZ7EY2D0Qx-YkppFgEm_YmoBVB0VGEs,2265
5
5
  lightpdf_aipdf_mcp/editor.py,sha256=vPaahaAV6pDZi_eheRGSgHzfZxc6ZqQyxHDgsNfdgjQ,29899
6
- lightpdf_aipdf_mcp/server.py,sha256=LVzQoDvliyvAQVISIoypc8PYyK4oQZU6IhaSRbk7jA8,64112
6
+ lightpdf_aipdf_mcp/server.py,sha256=UBiDc9Tozr-ZhzYL_eIanfOSeDWH1CMP-JRFAflUJEY,64485
7
7
  lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
8
- lightpdf_aipdf_mcp-0.1.100.dist-info/METADATA,sha256=RspRt5U0lWYVktBBbv6IQu917Q15gnrOsGLYltOdeRo,8120
9
- lightpdf_aipdf_mcp-0.1.100.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- lightpdf_aipdf_mcp-0.1.100.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
11
- lightpdf_aipdf_mcp-0.1.100.dist-info/RECORD,,
8
+ lightpdf_aipdf_mcp-0.1.101.dist-info/METADATA,sha256=uwUimApwgA0FZ6HvBLLpqNrAWNlqoLvZwNZ1PujsxW0,8120
9
+ lightpdf_aipdf_mcp-0.1.101.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ lightpdf_aipdf_mcp-0.1.101.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
11
+ lightpdf_aipdf_mcp-0.1.101.dist-info/RECORD,,