snowflake.snowpark.mcp.MCPServer.grant_usage¶
- MCPServer.grant_usage(session, role: str, *, database: Optional[str] = None, schema: Optional[str] = None, suffix: str = '', dry_run: bool = False) List[str][source]¶
Grants
rolewhat it needs to connect to the server and call each of its tools: usage on the database, schema and server, usage on every tool’s procedure, UDF, agent or search service and its database and schema, select on semantic views, and usage on every warehouse set on a tool. Returns the statements, which are not run whendry_runis True.It does not grant what a tool uses internally: the search services, semantic views, tables and warehouses an agent uses, or the objects a procedure or UDF reads. Grant those separately.
Tools without a
warehouserun on the caller’s default warehouse, which this can’t know, so it grants no warehouse for them. It grantsSNOWFLAKE.CORTEX_AGENT_USERfor agent and coding agent tools and no other Cortex database role: the Snowflake documentation lists no Cortex role for Cortex Analyst or Cortex Search tools through MCP. If calls to those tools fail, grant the Cortex database role your account uses (such asSNOWFLAKE.CORTEX_USER).