Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Remove capability check for `create-autogenerated-dashboard-tool`; clarify system prompt (#71589)

Noah Moss201824c6b20d
diff --git a/resources/metabot/prompts/system/internal.selmer b/resources/metabot/prompts/system/internal.selmer
index 04cfe668b83..536fcdb97cb 100644
--- a/resources/metabot/prompts/system/internal.selmer
+++ b/resources/metabot/prompts/system/internal.selmer
@@ -20,7 +20,7 @@ You are Metabot, a data analysis assistant who helps users explore and understan
<routing>
Explicit search ("Find...", "Do we have...") → Search for existing content
Explicit SQL request ("Write SQL...", "Create SQL query...") → Use SQL tools
-Explicit dashboard request ("Create dashboard...") → Use dashboard tools
+Explicit dashboard request ("Create dashboard...") → Use X-ray auto-generated dashboard tool (you cannot create custom dashboards with specific cards/layouts - only auto-generated X-ray dashboards based on a table, model, or metric)
Everything else → Use natural language querying (your default mode)
</routing>
diff --git a/src/metabase/metabot/agent/profiles.clj b/src/metabase/metabot/agent/profiles.clj
index 35db16c2908..ee1ecf7dbfe 100644
--- a/src/metabase/metabot/agent/profiles.clj
+++ b/src/metabase/metabot/agent/profiles.clj
@@ -169,8 +169,7 @@
"permission:write_transforms" :permission-write-transforms
"feature:transforms" :feature-transforms
"feature:transforms-python" :feature-transforms-python
- "feature:snippets" :feature-snippets
- "automagic-dashboards" :automagic-dashboards})
+ "feature:snippets" :feature-snippets})
(defn- capability->keyword
"Normalize a capability value to a keyword. Strings are looked up in the
diff --git a/src/metabase/metabot/tools/autogen_dashboard.clj b/src/metabase/metabot/tools/autogen_dashboard.clj
index 932c4274fe7..7892dc0a8f3 100644
--- a/src/metabase/metabot/tools/autogen_dashboard.clj
+++ b/src/metabase/metabot/tools/autogen_dashboard.clj
@@ -126,8 +126,7 @@
[:query_id {:optional true} [:maybe :string]]
[:report_id {:optional true} [:maybe :int]]]]])
-(mu/defn ^{:tool-name "create_autogenerated_dashboard"
- :capabilities #{:automagic-dashboards}}
+(mu/defn ^{:tool-name "create_autogenerated_dashboard"}
create-autogenerated-dashboard-tool
"Create an automatically generated dashboard using Metabase's X-ray feature.
diff --git a/test/metabase/metabot/agent/profiles_test.clj b/test/metabase/metabot/agent/profiles_test.clj
index 173370476c8..101ce274e6a 100644
--- a/test/metabase/metabot/agent/profiles_test.clj
+++ b/test/metabase/metabot/agent/profiles_test.clj
@@ -102,21 +102,17 @@
(deftest get-tools-for-profile-capabilities-test
(testing "filters tools by capabilities"
- (testing "empty capabilities excludes capability-gated tools"
+ (testing "empty capabilities excludes capability-gated tools but includes ungated tools"
(let [tools (profiles/get-tools-for-profile :internal [])]
+ ;; Ungated tools should always be available
(is (contains? tools "search"))
- (is (not (contains? tools "navigate_user")))
- (is (not (contains? tools "create_autogenerated_dashboard")))))
+ (is (contains? tools "create_autogenerated_dashboard"))
+ ;; Capability-gated tools should be excluded
+ (is (not (contains? tools "navigate_user")))))
- (testing "partial capabilities includes matching tools"
+ (testing "providing a capability includes tools gated by that capability"
(let [tools (profiles/get-tools-for-profile :internal [:frontend-navigate-user-v1])]
- (is (contains? tools "navigate_user"))
- (is (not (contains? tools "create_autogenerated_dashboard")))))
-
- (testing "full capabilities includes all tools"
- (let [tools (profiles/get-tools-for-profile :internal [:frontend-navigate-user-v1 :automagic-dashboards])]
- (is (contains? tools "navigate_user"))
- (is (contains? tools "create_autogenerated_dashboard"))))))
+ (is (contains? tools "navigate_user"))))))
(deftest get-tools-for-profile-string-capabilities-test
(testing "capabilities as strings (as sent by the API / benchmark client)"
@@ -158,8 +154,7 @@
(is (contains? tools "search") "ungated tools should remain")
(is (not (contains? tools "navigate_user")))
(is (not (contains? tools "create_sql_query"))
- "SQL tools should be gated by permission:write_sql_queries")
- (is (not (contains? tools "create_autogenerated_dashboard")))))))
+ "SQL tools should be gated by permission:write_sql_queries")))))
(deftest transform-feature-capabilities-test
(let [orig-has-feature premium-features/has-feature?
diff --git a/test/metabase/metabot/tools_test.clj b/test/metabase/metabot/tools_test.clj
index 005dcebfea8..8671a8be090 100644
--- a/test/metabase/metabot/tools_test.clj
+++ b/test/metabase/metabot/tools_test.clj
@@ -24,8 +24,7 @@
(testing "filters out tools that require missing capabilities"
(let [tool-vars [#'agent-tools/search-tool
- #'agent-tools/navigate-user-tool
- #'agent-tools/create-autogenerated-dashboard-tool]
+ #'agent-tools/navigate-user-tool]
capabilities #{}
result (#'profiles/filter-by-capabilities tool-vars capabilities)]
(is (= ["search"] (mapv #(:tool-name (meta %)) result)))))