| 772 | } |
| 773 | |
| 774 | static bool mcp_tool_allowed(cbm_mcp_tool_profile_t profile, const char *name) { |
| 775 | static const char *const analysis_tools[] = { |
| 776 | "search_graph", "query_graph", "trace_path", "get_code_snippet", |
| 777 | "get_graph_schema", "get_architecture", "search_code", "list_projects", |
| 778 | "index_status", "check_index_coverage", "detect_changes", |
| 779 | }; |
| 780 | static const char *const scout_tools[] = { |
| 781 | "search_graph", "trace_path", "get_code_snippet", "get_architecture", |
| 782 | "list_projects", "index_status", "check_index_coverage", |
| 783 | }; |
| 784 | if (!name) { |
| 785 | return false; |
| 786 | } |
| 787 | if (profile == CBM_MCP_TOOL_PROFILE_ALL) { |
| 788 | return true; |
| 789 | } |
| 790 | const char *const *allowed = NULL; |
| 791 | size_t allowed_count = 0U; |
| 792 | if (profile == CBM_MCP_TOOL_PROFILE_ANALYSIS) { |
| 793 | allowed = analysis_tools; |
| 794 | allowed_count = sizeof(analysis_tools) / sizeof(analysis_tools[0]); |
| 795 | } else if (profile == CBM_MCP_TOOL_PROFILE_SCOUT) { |
| 796 | allowed = scout_tools; |
| 797 | allowed_count = sizeof(scout_tools) / sizeof(scout_tools[0]); |
| 798 | } |
| 799 | for (size_t i = 0U; i < allowed_count; i++) { |
| 800 | if (strcmp(name, allowed[i]) == 0) { |
| 801 | return true; |
| 802 | } |
| 803 | } |
| 804 | return false; |
| 805 | } |
| 806 | |
| 807 | static const char *mcp_tool_profile_name(cbm_mcp_tool_profile_t profile) { |
| 808 | return profile == CBM_MCP_TOOL_PROFILE_SCOUT ? "scout" : "analysis"; |
no outgoing calls
no test coverage detected