mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-16 08:25:18 +02:00
chore: add mcp documentation
This commit is contained in:
parent
5ecc0d4da9
commit
599dae87a9
6 changed files with 120 additions and 86 deletions
|
|
@ -62,8 +62,10 @@ def _snippet(content: str, query_tokens: list[str], width: int = 240) -> str:
|
|||
if idx >= 0:
|
||||
start = max(0, idx - width // 2)
|
||||
end = min(len(content), start + width)
|
||||
return ("…" if start > 0 else "") + content[start:end].strip() + (
|
||||
"…" if end < len(content) else ""
|
||||
return (
|
||||
("…" if start > 0 else "")
|
||||
+ content[start:end].strip()
|
||||
+ ("…" if end < len(content) else "")
|
||||
)
|
||||
return content[:width].strip() + ("…" if len(content) > width else "")
|
||||
|
||||
|
|
@ -83,9 +85,7 @@ async def search_dograh_docs(query: str, limit: int = 5) -> list[dict]:
|
|||
return []
|
||||
|
||||
scores = bm25.get_scores(tokens)
|
||||
ranked = sorted(
|
||||
zip(scores, docs), key=lambda pair: pair[0], reverse=True
|
||||
)[:limit]
|
||||
ranked = sorted(zip(scores, docs), key=lambda pair: pair[0], reverse=True)[:limit]
|
||||
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,8 +33,10 @@ async def list_workflows(status: str | None = None) -> list[dict]:
|
|||
async def get_workflow(workflow_id: int) -> dict:
|
||||
"""Fetch a single agent by id, including its current published definition."""
|
||||
user = await authenticate_mcp_request()
|
||||
workflow = await db_client.get_workflow_by_id(workflow_id)
|
||||
if not workflow or workflow.organization_id != user.selected_organization_id:
|
||||
workflow = await db_client.get_workflow(
|
||||
workflow_id, organization_id=user.selected_organization_id
|
||||
)
|
||||
if not workflow:
|
||||
raise HTTPException(status_code=404, detail=f"Workflow {workflow_id} not found")
|
||||
|
||||
current = workflow.current_definition
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue