Update cognee-mcp/cognee_mcp/server.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
b132ff4990
commit
7b0bfe9504
1 changed files with 6 additions and 4 deletions
|
|
@ -196,10 +196,12 @@ async def handle_call_tool(
|
||||||
elif name == "visualize":
|
elif name == "visualize":
|
||||||
with open(os.devnull, "w") as fnull:
|
with open(os.devnull, "w") as fnull:
|
||||||
with redirect_stdout(fnull), redirect_stderr(fnull):
|
with redirect_stdout(fnull), redirect_stderr(fnull):
|
||||||
"""Create a thumbnail from an image"""
|
try:
|
||||||
await cognee.visualize
|
await cognee.visualize
|
||||||
img = get_freshest_png(".")
|
img = get_freshest_png(".")
|
||||||
return types.Image(data=img.tobytes(), format="png")
|
return types.Image(data=img.tobytes(), format="png")
|
||||||
|
except (FileNotFoundError, IOError, ValueError) as e:
|
||||||
|
raise ValueError(f"Failed to create visualization: {str(e)}")
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown tool: {name}")
|
raise ValueError(f"Unknown tool: {name}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue