@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.
- package/package.json +1 -1
- package/src/server.py +8 -3
package/package.json
CHANGED
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) ->
|
|
197
|
+
def screenshot(save_name: str = None) -> dict:
|
|
198
198
|
"""Capture a screenshot and save to the export folder."""
|
|
199
|
-
|
|
200
|
-
|
|
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()
|