List Cortex Agents in a Snowflake account, database, or schema. Use for: list agents, show agents, what agents exist, find agents.
Based on what the user provides, pick the most specific scope:
| User provides | Scope | SQL |
|---|---|---|
| Database + Schema | Schema | SHOW AGENTS IN SCHEMA <DATABASE>.<SCHEMA>; |
| Database only | Database | SHOW AGENTS IN DATABASE <DATABASE>; |
| Nothing / "all" | Account | SHOW AGENTS IN ACCOUNT; |
Waterfall logic:
Run the appropriate SQL command via snowflake_sql_execute:
-- Schema scope (most specific)
SHOW AGENTS IN SCHEMA <DATABASE>.<SCHEMA>;
-- Database scope
SHOW AGENTS IN DATABASE <DATABASE>;
-- Account scope (broadest)
SHOW AGENTS IN ACCOUNT;
If a specific role is needed:
USE ROLE <ROLE>;
SHOW AGENTS IN ACCOUNT;
Present the results in a readable format. Key columns to highlight:
If no agents are found, inform the user:
No agents found in <scope>.
List complete.