Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

fix: return a message when an MCP export destination is a directory

dex0shubham40781ebb1d7d
diff --git a/hyperextract/mcp_server.py b/hyperextract/mcp_server.py
index 1fe04eb..993eb0c 100644
--- a/hyperextract/mcp_server.py
+++ b/hyperextract/mcp_server.py
@@ -320,6 +320,8 @@ def export_graphml(ka_path: str, output: str, overwrite: bool = False) -> str:
return str(e)
except FileExistsError as e:
return f"{e} Pass overwrite=true to overwrite it."
+ except IsADirectoryError as e:
+ return str(e)
return f"Wrote GraphML to {dest}"
@@ -376,6 +378,8 @@ def export_jsonld(ka_path: str, output: str, overwrite: bool = False) -> str:
return str(e)
except FileExistsError as e:
return f"{e} Pass overwrite=true to overwrite it."
+ except IsADirectoryError as e:
+ return str(e)
return f"Wrote JSON-LD to {dest}"
@@ -401,6 +405,8 @@ def export_cypher(ka_path: str, output: str, overwrite: bool = False) -> str:
return str(e)
except FileExistsError as e:
return f"{e} Pass overwrite=true to overwrite it."
+ except IsADirectoryError as e:
+ return str(e)
return f"Wrote Cypher to {dest}"