Bound indexed retrieval operations
This commit is contained in:
parent
ad4f52b239
commit
c69cd16515
6 changed files with 208 additions and 46 deletions
|
|
@ -577,22 +577,36 @@ def _create_bound_server(service: DocForgeService, *, read_only: bool) -> FastMC
|
|||
)
|
||||
|
||||
@server.tool(name="docforge_backlinks")
|
||||
def backlinks(node_id: str, relation: str | None = None) -> dict[str, Any]:
|
||||
def backlinks(
|
||||
node_id: str,
|
||||
relation: str | None = None,
|
||||
limit: int | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Return bounded incoming relationships for one exact stable node."""
|
||||
|
||||
return service.invoke(lambda: service.index.backlinks(node_id, relation=relation))
|
||||
return service.invoke(
|
||||
lambda: service.index.backlinks(node_id, relation=relation, limit=limit)
|
||||
)
|
||||
|
||||
@server.tool(name="docforge_dependencies")
|
||||
def dependencies(node_id: str, depth: int = 2) -> dict[str, Any]:
|
||||
def dependencies(
|
||||
node_id: str,
|
||||
depth: int = 2,
|
||||
limit: int | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Traverse declared depends_on relationships within the configured depth limit."""
|
||||
|
||||
return service.invoke(lambda: service.index.dependencies(node_id, depth=depth))
|
||||
return service.invoke(lambda: service.index.dependencies(node_id, depth=depth, limit=limit))
|
||||
|
||||
@server.tool(name="docforge_impact")
|
||||
def impact(node_id: str, depth: int = 2) -> dict[str, Any]:
|
||||
def impact(
|
||||
node_id: str,
|
||||
depth: int = 2,
|
||||
limit: int | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Traverse bounded incoming relationships and report exact paths."""
|
||||
|
||||
return service.invoke(lambda: service.index.impact(node_id, depth=depth))
|
||||
return service.invoke(lambda: service.index.impact(node_id, depth=depth, limit=limit))
|
||||
|
||||
@server.tool(name="docforge_get_context")
|
||||
def get_context(profile: str, budget: int | None = None) -> dict[str, Any]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue