diff --git a/server/src/handlers/graph.rs b/server/src/handlers/graph.rs index 6e9ff0c..c0744e2 100644 --- a/server/src/handlers/graph.rs +++ b/server/src/handlers/graph.rs @@ -625,6 +625,7 @@ impl McpTool for ReadGraphHandler { .entities .iter() .filter(|(_, v)| req.namespace.as_ref().is_none_or(|ns| &v.namespace == ns)) + .filter(|(_, v)| req.entity_type.as_ref().is_none_or(|et| &v.entity_type == et)) .collect(); let total_count = filtered_entities.len(); @@ -1120,7 +1121,7 @@ impl McpTool for GetSubgraphHandler { crate::error::AppError::Internal("root_entity is required".to_string()) })?; let depth = req.depth.unwrap_or(2); - let format = req.format.unwrap_or(SubgraphFormat::Json); + let format = req.format.unwrap_or(SubgraphFormat::MarkdownTree); let (matched_entities, matched_relations) = state.read_graph(|full| { let mut adj: std::collections::HashMap<&str, Vec<&str>> = diff --git a/server/src/tools.rs b/server/src/tools.rs index 04c85a7..2888d06 100644 --- a/server/src/tools.rs +++ b/server/src/tools.rs @@ -100,6 +100,8 @@ pub struct DeleteRelationsTool { pub struct ReadGraphTool { /// Optional namespace to restrict the read to. pub namespace: Option, + /// Optional entity_type to filter entities by (e.g. 'DatabaseTable'). + pub entity_type: Option, /// Optional token budget cap. Truncates graph outputs to fit within the specified token budget. pub max_tokens: Option, /// Optional maximum number of entities to return (pagination). @@ -213,7 +215,7 @@ pub struct GetSubgraphTool { pub root_entity: Option, /// Maximum search depth (hops). Defaults to 2. pub depth: Option, - /// Output format: 'json' (raw entities and relations) or 'markdown_tree' (compact topology tree). Defaults to 'json'. + /// Output format: 'json' (raw entities and relations) or 'markdown_tree' (compact topology tree). Defaults to 'markdown_tree'. pub format: Option, /// Optional namespace filter. pub namespace: Option,