Coverage for src/qdrant_loader_mcp_server/fastmcp_tools/graph.py: 73%
11 statements
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
« prev ^ index » next coverage.py v7.15.0, created at 2026-07-20 10:15 +0000
1"""
2FastMCP Knowledge Graph tools (lazy-loading).
4Delegate to IntelligenceHandler for graph exploration and querying
5capabilities, including:
7- find_ticket_dependencies: traverse Jira blocking dependencies
8- get_epic_tree: retrieve full epic hierarchy
9- find_related_documents: generic multi-hop graph traversal
10- query_knowledge_graph: execute raw Cypher queries
12Returns the structured graph response payload from the underlying handler.
13"""
15from __future__ import annotations
17from typing import Annotated, Any
19from fastmcp import Context, FastMCP
20from pydantic import Field
22from ._common import REQUEST_ID, unwrap
25def register_graph_tools(mcp: FastMCP) -> None:
26 @mcp.tool(annotations={"readOnlyHint": True})
27 async def find_ticket_dependencies(
28 ctx: Context,
29 ticket_key: Annotated[
30 str,
31 Field(
32 description="Jira ticket key to analyze dependency relationships",
33 min_length=1,
34 ),
35 ],
36 depth: Annotated[
37 int,
38 Field(
39 description="Maximum traversal depth for dependency relationships",
40 ge=1,
41 le=10,
42 ),
43 ] = 2,
44 ) -> dict[str, Any]:
45 """Traverse Jira blocking dependencies in the knowledge graph."""
46 handler = ctx.lifespan_context["intelligence_handler"]
48 params = {
49 "ticket_key": ticket_key,
50 "depth": depth,
51 }
53 return unwrap(
54 await handler.handle_find_ticket_dependencies(
55 REQUEST_ID,
56 params,
57 )
58 )