Ragex. MCP. Handlers. Tools
(Ragex v0.32.2)
View Source
Handles MCP tool-related requests (tools/list and tools/call).
Implements the full Ragex MCP tool catalogue (~50 tools across categories):
- Core analysis:
analyze_file,analyze_directory,query_graph,list_nodes - File watching:
watch_directory,unwatch_directory,list_watched - Semantic search:
semantic_search,hybrid_search,get_embeddings_stats,metaast_search,cross_language_alternatives,expand_query,find_metaast_pattern - Graph algorithms:
find_paths,find_callers,graph_stats,betweenness_centrality,closeness_centrality,detect_communities,export_graph - Code editing:
edit_file,edit_files,validate_edit,rollback_edit,edit_history,refactor_code,advanced_refactor - Refactor previews:
preview_refactor,refactor_conflicts,undo_refactor,refactor_history,visualize_impact - Quality & complexity:
analyze_quality,quality_report,find_complex_code - Security:
scan_security,security_audit,check_secrets,analyze_security_issues - Code analysis:
find_dead_code,analyze_dead_code_patterns,find_duplicates,find_similar_code,detect_smells,analyze_business_logic - Dependencies:
analyze_dependencies,find_circular_dependencies,coupling_report - Impact & suggestions:
analyze_impact,estimate_refactoring_effort,risk_assessment,suggest_refactorings,explain_suggestion - Semantic / OpKind:
semantic_operations,semantic_analysis - RAG pipeline:
rag_query,rag_explain,rag_suggest(+_streamvariants) - AI features:
validate_with_ai - AI usage tracking:
get_ai_usage,get_ai_cache_stats,clear_ai_cache - Agent:
agent_analyze,agent_chat,agent_session_info,agent_list_sessions,agent_clear_session,read_file - Git archaeology:
git_blame,git_history,git_pr_info,co_change_analysis,git_enrich
Summary
Functions
Full-featured betweenness_centrality implementation (honors max_nodes/
normalize, sorts and formats results). Public so
Ragex.Plugins.GraphAnalytics can delegate to it -- see the Ragex Codebase
Health & Architecture Improvement Plan.
Executes a tool call.
Executes a streaming tool call, pushing partial chunks via progress_fn.
Executes multiple tool calls concurrently in parallel.
Full-featured check_secrets implementation (file or directory, uses the
Security analyzer's :hardcoded_secret category -- not BusinessLogic).
Public so Ragex.Plugins.SecurityAudit can delegate to it -- see the Ragex
Codebase Health & Architecture Improvement Plan.
Full-featured detect_smells implementation (file or directory, thresholds,
smell_types filter, min_severity). Public so Ragex.Plugins.CodeQuality
can delegate to it -- see the Ragex Codebase Health & Architecture
Improvement Plan.
Full-featured find_dead_code implementation (scope, min_confidence,
exclude_tests, include_callbacks, multiple output formats). Public so
Ragex.Plugins.CodeQuality can delegate to it rather than shadowing it
with a single-file stub -- see the Ragex Codebase Health & Architecture
Improvement Plan.
Full-featured find_duplicates implementation (two-file comparison mode,
directory scanning, threshold/exclude_patterns options, error handling).
Public so Ragex.Plugins.CodeQuality can delegate to it -- see the Ragex
Codebase Health & Architecture Improvement Plan.
Lists all available tools.
Full-featured query_graph implementation (find_module/find_function/get_calls/
get_dependencies/get_callers, with PageRank enrichment). Public so
Ragex.Plugins.GraphAnalytics can delegate to it rather than shadowing it
with a stub -- see the Ragex Codebase Health & Architecture Improvement Plan.
Full-featured scan_security implementation (file or directory, category
filtering, aggregated severity counts). Public so
Ragex.Plugins.SecurityAudit can delegate to it -- see the Ragex Codebase
Health & Architecture Improvement Plan.
Functions
Full-featured betweenness_centrality implementation (honors max_nodes/
normalize, sorts and formats results). Public so
Ragex.Plugins.GraphAnalytics can delegate to it -- see the Ragex Codebase
Health & Architecture Improvement Plan.
Executes a tool call.
Executes a streaming tool call, pushing partial chunks via progress_fn.
progress_fn has signature (partial_text :: String.t(), done :: boolean()) -> any().
It is called once per content chunk from the underlying AI stream, and once
with done: true after the final chunk. Non-streaming tools fall back to
call_tool/2.
Executes multiple tool calls concurrently in parallel.
Full-featured check_secrets implementation (file or directory, uses the
Security analyzer's :hardcoded_secret category -- not BusinessLogic).
Public so Ragex.Plugins.SecurityAudit can delegate to it -- see the Ragex
Codebase Health & Architecture Improvement Plan.
Full-featured detect_smells implementation (file or directory, thresholds,
smell_types filter, min_severity). Public so Ragex.Plugins.CodeQuality
can delegate to it -- see the Ragex Codebase Health & Architecture
Improvement Plan.
Full-featured find_dead_code implementation (scope, min_confidence,
exclude_tests, include_callbacks, multiple output formats). Public so
Ragex.Plugins.CodeQuality can delegate to it rather than shadowing it
with a single-file stub -- see the Ragex Codebase Health & Architecture
Improvement Plan.
Full-featured find_duplicates implementation (two-file comparison mode,
directory scanning, threshold/exclude_patterns options, error handling).
Public so Ragex.Plugins.CodeQuality can delegate to it -- see the Ragex
Codebase Health & Architecture Improvement Plan.
@spec list_tools() :: map()
Lists all available tools.
Full-featured query_graph implementation (find_module/find_function/get_calls/
get_dependencies/get_callers, with PageRank enrichment). Public so
Ragex.Plugins.GraphAnalytics can delegate to it rather than shadowing it
with a stub -- see the Ragex Codebase Health & Architecture Improvement Plan.
Full-featured scan_security implementation (file or directory, category
filtering, aggregated severity counts). Public so
Ragex.Plugins.SecurityAudit can delegate to it -- see the Ragex Codebase
Health & Architecture Improvement Plan.