weavatrix_rust/operations/catalog/
profile.rs1use std::str::FromStr;
2
3#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
5pub enum ToolProfile {
6 #[default]
8 All,
9 Code,
11 Seo,
13}
14
15impl ToolProfile {
16 #[must_use]
17 pub fn allows(self, tool: &str) -> bool {
18 match self {
19 Self::All => true,
20 Self::Code => tool != "seo_link_suggestions",
21 Self::Seo => matches!(
22 tool,
23 "graph_stats"
24 | "get_node"
25 | "get_neighbors"
26 | "query_graph"
27 | "shortest_path"
28 | "search_code"
29 | "read_source"
30 | "context_bundle"
31 | "list_communities"
32 | "get_community"
33 | "module_map"
34 | "rebuild_graph"
35 | "open_repo"
36 | "list_known_repos"
37 | "semantic_link"
38 | "vector_search"
39 | "seo_link_suggestions"
40 | "memory_context"
41 ),
42 }
43 }
44}
45
46impl FromStr for ToolProfile {
47 type Err = String;
48
49 fn from_str(value: &str) -> Result<Self, Self::Err> {
50 match value {
51 "all" => Ok(Self::All),
52 "code" => Ok(Self::Code),
53 "seo" | "content" => Ok(Self::Seo),
54 _ => Err(format!(
55 "unknown tool profile {value:?}; expected all, code, or seo"
56 )),
57 }
58 }
59}