fix: Run mcp cognify and codify as background async task [COG-1647] (#655)
…t issues <!-- .github/pull_request_template.md --> ## Description Resolve issue with MCP timeout by switching cognify and codify to run as background async tasks ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced feedback messages now inform users when operations are running in the background, providing an estimated wait time of up to 4 minutes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
4bd17bd82c
commit
ede344be5d
1 changed files with 19 additions and 7 deletions
|
|
@ -93,17 +93,29 @@ async def call_tools(name: str, arguments: dict) -> list[types.TextContent]:
|
|||
with open(os.devnull, "w") as fnull:
|
||||
with redirect_stdout(fnull), redirect_stderr(fnull):
|
||||
if name == "cognify":
|
||||
await cognify(
|
||||
text=arguments["text"],
|
||||
graph_model_file=arguments.get("graph_model_file", None),
|
||||
graph_model_name=arguments.get("graph_model_name", None),
|
||||
asyncio.create_task(
|
||||
cognify(
|
||||
text=arguments["text"],
|
||||
graph_model_file=arguments.get("graph_model_file"),
|
||||
graph_model_name=arguments.get("graph_model_name"),
|
||||
)
|
||||
)
|
||||
|
||||
return [types.TextContent(type="text", text="Ingested")]
|
||||
return [
|
||||
types.TextContent(
|
||||
type="text",
|
||||
text="Background process launched due to MCP timeout limitations. Estimated completion time up to 4 minutes.",
|
||||
)
|
||||
]
|
||||
if name == "codify":
|
||||
await codify(arguments.get("repo_path"))
|
||||
asyncio.create_task(codify(arguments.get("repo_path")))
|
||||
|
||||
return [types.TextContent(type="text", text="Indexed")]
|
||||
return [
|
||||
types.TextContent(
|
||||
type="text",
|
||||
text="Background process launched due to MCP timeout limitations. Estimated completion time up to 4 minutes.",
|
||||
)
|
||||
]
|
||||
elif name == "search":
|
||||
search_results = await search(
|
||||
arguments["search_query"], arguments["search_type"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue