@tanskong/office-assistant 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.py +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanskong/office-assistant",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Office Assistant - AI-powered Office automation via MCP protocol with license protection",
5
5
  "main": "bin/office-assistant.js",
6
6
  "bin": {
package/src/server.py CHANGED
@@ -194,10 +194,15 @@ def run_python(code: str, app_name: str = "Excel") -> dict:
194
194
  # ========== System Tools ==========
195
195
 
196
196
  @mcp.tool()
197
- def screenshot(save_name: str = None) -> str:
197
+ def screenshot(save_name: str = None) -> dict:
198
198
  """Capture a screenshot and save to the export folder."""
199
- path = Officer.ScreenShot(save_name)
200
- return path
199
+ try:
200
+ path = Officer.ScreenShot(save_name)
201
+ return {"success": True, "path": path}
202
+ except ImportError as e:
203
+ return {"success": False, "error": "缺少 Pillow 模块,请运行: pip install Pillow", "detail": str(e)}
204
+ except Exception as e:
205
+ return {"success": False, "error": str(e)}
201
206
 
202
207
 
203
208
  @mcp.tool()