<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Genie not able to list MCP prompts in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/genie-not-able-to-list-mcp-prompts/m-p/163113#M1945</link>
    <description>&lt;P class="PDq2pG_selectionAnchorContainer" data-end="113" data-start="0"&gt;This almost always turns out to be &lt;CODE data-end="54" data-start="35"&gt;st.cache_resource&lt;/CODE&gt; on the connection, not the reverse proxy reusing anything.&lt;/P&gt;
&lt;P data-end="582" data-start="115"&gt;You said you checked your &lt;CODE data-end="156" data-start="141"&gt;st.cache_data&lt;/CODE&gt; functions and they key on username, which is the right instinct, but the leak usually hides in whatever function opens the SQL connection or session object. &lt;CODE data-end="333" data-start="314"&gt;st.cache_resource&lt;/CODE&gt; caches are global by default, they're shared across every user and every session in the app process, not per-session like &lt;CODE data-end="474" data-start="456"&gt;st.session_state&lt;/CODE&gt;. The cache key comes from the function's arguments, so if your connection-builder function looks like this:&lt;/P&gt;
&lt;DIV class="relative w-full mt-4 mb-1"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"&gt;
&lt;DIV class="relative h-full w-full border-radius-3xl bg-(--code-block-surface) corner-superellipse/1.1 overflow-clip rounded-3xl [--code-block-surface:var(--bg-elevated-secondary)] dark:[--code-block-surface:var(--composer-surface-primary)] lxnfua_clipPathFallback"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative z-0 flex max-w-full"&gt;
&lt;DIV id="code-block-viewer" class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼs ͼ16" dir="ltr"&gt;
&lt;DIV class="cm-scroller"&gt;
&lt;PRE class="cm-content q9tKkq_readonly m-0"&gt;&lt;CODE&gt;&lt;SPAN class="ͼu"&gt;@&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;cache_resource&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;ttl&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼy"&gt;300&lt;/SPAN&gt;&lt;SPAN&gt;)
&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;def&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;get_connection&lt;/SPAN&gt;&lt;SPAN&gt;():
    &lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;return&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;connect(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;server_hostname&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;http_path&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;access_token&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_access_token&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-end="1119" data-start="740"&gt;every user hits the same cached connection object for up to the TTL window, and that connection was opened with whichever token happened to trigger the first cache miss. That's exactly the symptom you're describing: queries occasionally running under a previous user's identity, and it'll look "random" because it only shows up when the cache is warm from someone else's request.&lt;/P&gt;
&lt;P data-end="1216" data-start="1121"&gt;The fix is to make the token part of the cache key so each identity gets its own cached object:&lt;/P&gt;
&lt;DIV class="relative w-full mt-4 mb-1"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"&gt;
&lt;DIV class="relative h-full w-full border-radius-3xl bg-(--code-block-surface) corner-superellipse/1.1 overflow-clip rounded-3xl [--code-block-surface:var(--bg-elevated-secondary)] dark:[--code-block-surface:var(--composer-surface-primary)] lxnfua_clipPathFallback"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative z-0 flex max-w-full"&gt;
&lt;DIV id="code-block-viewer" class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼs ͼ16" dir="ltr"&gt;
&lt;DIV class="cm-scroller"&gt;
&lt;PRE class="cm-content q9tKkq_readonly m-0"&gt;&lt;CODE&gt;&lt;SPAN class="ͼu"&gt;@&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;cache_resource&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;ttl&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼy"&gt;300&lt;/SPAN&gt;&lt;SPAN&gt;)
&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;def&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;get_connection&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_token&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;str&lt;/SPAN&gt;&lt;SPAN&gt;):
    &lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;return&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;connect(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;server_hostname&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;http_path&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;access_token&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_token&lt;/SPAN&gt;&lt;SPAN&gt;)

&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;conn&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;get_connection&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_access_token&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-end="1608" data-start="1424"&gt;Or simplest and safest, don't cache the connection at all, open it fresh per request and close it after the query, which is what Databricks' own Apps examples do for this exact reason.&lt;/P&gt;
&lt;P data-end="1827" data-start="1610"&gt;To your second question, yes, there's a cheap way to verify the token belongs to who you think before you use it. Use the SDK with that specific token and check the identity it resolves to against &lt;CODE data-end="1826" data-start="1807"&gt;X-Forwarded-Email&lt;/CODE&gt;:&lt;/P&gt;
&lt;DIV class="relative w-full mt-4 mb-1"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"&gt;
&lt;DIV class="relative h-full w-full border-radius-3xl bg-(--code-block-surface) corner-superellipse/1.1 overflow-clip rounded-3xl [--code-block-surface:var(--bg-elevated-secondary)] dark:[--code-block-surface:var(--composer-surface-primary)] lxnfua_clipPathFallback"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative z-0 flex max-w-full"&gt;
&lt;DIV id="code-block-viewer" class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼs ͼ16" dir="ltr"&gt;
&lt;DIV class="cm-scroller"&gt;
&lt;PRE class="cm-content q9tKkq_readonly m-0"&gt;&lt;CODE&gt;&lt;SPAN class="ͼv"&gt;from&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;databricks&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;sdk&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;import&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;WorkspaceClient&lt;/SPAN&gt;

&lt;SPAN class="ͼ11"&gt;w&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;WorkspaceClient&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;host&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;host&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;token&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_access_token&lt;/SPAN&gt;&lt;SPAN&gt;)
&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;me&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;w&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;current_user&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;me()
&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;if&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;me&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;user_name &lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;username&lt;/SPAN&gt;&lt;SPAN&gt;:
    &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;error(&lt;/SPAN&gt;&lt;SPAN class="ͼz"&gt;"Session identity mismatch, please refresh."&lt;/SPAN&gt;&lt;SPAN&gt;)
    &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;stop()&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-is-only-node="" data-is-last-node="" data-end="2556" data-start="2071"&gt;One more thing worth knowing separately from the caching issue: &lt;CODE data-end="2155" data-start="2135"&gt;st.context.headers&lt;/CODE&gt; itself is only populated once, at the initial page load / WebSocket connection, and doesn't refresh on reruns. So on a long-lived tab, even without any caching bug, the token you're holding can go stale if the underlying session persists across a reconnect. The identity check above catches that case too, since it fails closed instead of quietly running a query under a token that no longer matches.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jul 2026 17:57:20 GMT</pubDate>
    <dc:creator>iyashk-DB</dc:creator>
    <dc:date>2026-07-15T17:57:20Z</dc:date>
    <item>
      <title>Genie not able to list MCP prompts</title>
      <link>https://community.databricks.com/t5/generative-ai/genie-not-able-to-list-mcp-prompts/m-p/160673#M1900</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;I'm building a custom MCP proxy server (hosted as a Databricks App) that forwards requests to an upstream MCP server. The upstream server exposes both **tools** and **prompts** as per the MCP specification.&lt;/P&gt;&lt;P&gt;I can confirm that Genie Code successfully discovers and calls tools via `tools/list` and `tools/call`. However, I'm unable to find any documentation or confirmation on whether Genie Code also supports the MCP **prompts** primitive — specifically:&lt;/P&gt;&lt;P&gt;- Does Genie Code ever call `prompts/list` on a connected MCP server?&lt;BR /&gt;- Does Genie Code ever call `prompts/get` to invoke a specific prompt?&lt;BR /&gt;- If prompts are supported, how does Genie Code surface or use them in Agent mode?&lt;/P&gt;&lt;P&gt;The [MCP documentation on Databricks](&lt;A href="https://docs.databricks.com/aws/en/generative-ai/mcp/" target="_blank"&gt;https://docs.databricks.com/aws/en/generative-ai/mcp/&lt;/A&gt;) describes MCP as a standard for *"tools, resources, prompts, and other contextual information"*, but all concrete examples and limits (e.g. the 20-item cap) only reference tools. There is no explicit mention of prompt discovery or invocation in Genie Code.&lt;/P&gt;&lt;P&gt;**My setup:**&lt;BR /&gt;- Custom MCP server deployed as a Databricks App&lt;BR /&gt;- FastMCP with `stateless_http=True`&lt;BR /&gt;- Server correctly responds to `prompts/list` and `prompts/get` (verified via MCP Inspector)&lt;BR /&gt;- Genie Code connects successfully and uses tools, but no evidence of `prompts/list` being called&lt;/P&gt;&lt;P&gt;Has anyone confirmed whether MCP prompts are supported, planned, or intentionally out of scope for Genie Code? Any official reference or firsthand experience would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2026 13:29:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/genie-not-able-to-list-mcp-prompts/m-p/160673#M1900</guid>
      <dc:creator>sandyveeru</dc:creator>
      <dc:date>2026-06-26T13:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Genie not able to list MCP prompts</title>
      <link>https://community.databricks.com/t5/generative-ai/genie-not-able-to-list-mcp-prompts/m-p/163113#M1945</link>
      <description>&lt;P class="PDq2pG_selectionAnchorContainer" data-end="113" data-start="0"&gt;This almost always turns out to be &lt;CODE data-end="54" data-start="35"&gt;st.cache_resource&lt;/CODE&gt; on the connection, not the reverse proxy reusing anything.&lt;/P&gt;
&lt;P data-end="582" data-start="115"&gt;You said you checked your &lt;CODE data-end="156" data-start="141"&gt;st.cache_data&lt;/CODE&gt; functions and they key on username, which is the right instinct, but the leak usually hides in whatever function opens the SQL connection or session object. &lt;CODE data-end="333" data-start="314"&gt;st.cache_resource&lt;/CODE&gt; caches are global by default, they're shared across every user and every session in the app process, not per-session like &lt;CODE data-end="474" data-start="456"&gt;st.session_state&lt;/CODE&gt;. The cache key comes from the function's arguments, so if your connection-builder function looks like this:&lt;/P&gt;
&lt;DIV class="relative w-full mt-4 mb-1"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"&gt;
&lt;DIV class="relative h-full w-full border-radius-3xl bg-(--code-block-surface) corner-superellipse/1.1 overflow-clip rounded-3xl [--code-block-surface:var(--bg-elevated-secondary)] dark:[--code-block-surface:var(--composer-surface-primary)] lxnfua_clipPathFallback"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative z-0 flex max-w-full"&gt;
&lt;DIV id="code-block-viewer" class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼs ͼ16" dir="ltr"&gt;
&lt;DIV class="cm-scroller"&gt;
&lt;PRE class="cm-content q9tKkq_readonly m-0"&gt;&lt;CODE&gt;&lt;SPAN class="ͼu"&gt;@&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;cache_resource&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;ttl&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼy"&gt;300&lt;/SPAN&gt;&lt;SPAN&gt;)
&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;def&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;get_connection&lt;/SPAN&gt;&lt;SPAN&gt;():
    &lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;return&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;connect(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;server_hostname&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;http_path&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;access_token&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_access_token&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-end="1119" data-start="740"&gt;every user hits the same cached connection object for up to the TTL window, and that connection was opened with whichever token happened to trigger the first cache miss. That's exactly the symptom you're describing: queries occasionally running under a previous user's identity, and it'll look "random" because it only shows up when the cache is warm from someone else's request.&lt;/P&gt;
&lt;P data-end="1216" data-start="1121"&gt;The fix is to make the token part of the cache key so each identity gets its own cached object:&lt;/P&gt;
&lt;DIV class="relative w-full mt-4 mb-1"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"&gt;
&lt;DIV class="relative h-full w-full border-radius-3xl bg-(--code-block-surface) corner-superellipse/1.1 overflow-clip rounded-3xl [--code-block-surface:var(--bg-elevated-secondary)] dark:[--code-block-surface:var(--composer-surface-primary)] lxnfua_clipPathFallback"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative z-0 flex max-w-full"&gt;
&lt;DIV id="code-block-viewer" class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼs ͼ16" dir="ltr"&gt;
&lt;DIV class="cm-scroller"&gt;
&lt;PRE class="cm-content q9tKkq_readonly m-0"&gt;&lt;CODE&gt;&lt;SPAN class="ͼu"&gt;@&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;cache_resource&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;ttl&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼy"&gt;300&lt;/SPAN&gt;&lt;SPAN&gt;)
&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;def&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;get_connection&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_token&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;str&lt;/SPAN&gt;&lt;SPAN&gt;):
    &lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;return&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;connect(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;server_hostname&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;http_path&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;..., &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;access_token&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_token&lt;/SPAN&gt;&lt;SPAN&gt;)

&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;conn&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;get_connection&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_access_token&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-end="1608" data-start="1424"&gt;Or simplest and safest, don't cache the connection at all, open it fresh per request and close it after the query, which is what Databricks' own Apps examples do for this exact reason.&lt;/P&gt;
&lt;P data-end="1827" data-start="1610"&gt;To your second question, yes, there's a cheap way to verify the token belongs to who you think before you use it. Use the SDK with that specific token and check the identity it resolves to against &lt;CODE data-end="1826" data-start="1807"&gt;X-Forwarded-Email&lt;/CODE&gt;:&lt;/P&gt;
&lt;DIV class="relative w-full mt-4 mb-1"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="contents"&gt;
&lt;DIV class="border border-token-border-light border-radius-3xl corner-superellipse/1.1 rounded-3xl"&gt;
&lt;DIV class="relative h-full w-full border-radius-3xl bg-(--code-block-surface) corner-superellipse/1.1 overflow-clip rounded-3xl [--code-block-surface:var(--bg-elevated-secondary)] dark:[--code-block-surface:var(--composer-surface-primary)] lxnfua_clipPathFallback"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class="h-full min-h-0 min-w-0"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class=""&gt;
&lt;DIV class="relative z-0 flex max-w-full"&gt;
&lt;DIV id="code-block-viewer" class="q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch ͼs ͼ16" dir="ltr"&gt;
&lt;DIV class="cm-scroller"&gt;
&lt;PRE class="cm-content q9tKkq_readonly m-0"&gt;&lt;CODE&gt;&lt;SPAN class="ͼv"&gt;from&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;databricks&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;sdk&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;import&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;WorkspaceClient&lt;/SPAN&gt;

&lt;SPAN class="ͼ11"&gt;w&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;WorkspaceClient&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;host&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;host&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;token&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;user_access_token&lt;/SPAN&gt;&lt;SPAN&gt;)
&lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;me&lt;/SPAN&gt; &lt;SPAN class="ͼv"&gt;=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;w&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;current_user&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;me()
&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;if&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;me&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;user_name &lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;!=&lt;/SPAN&gt; &lt;SPAN class="ͼ11"&gt;username&lt;/SPAN&gt;&lt;SPAN&gt;:
    &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;error(&lt;/SPAN&gt;&lt;SPAN class="ͼz"&gt;"Session identity mismatch, please refresh."&lt;/SPAN&gt;&lt;SPAN&gt;)
    &lt;/SPAN&gt;&lt;SPAN class="ͼ11"&gt;st&lt;/SPAN&gt;&lt;SPAN class="ͼv"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;stop()&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-is-only-node="" data-is-last-node="" data-end="2556" data-start="2071"&gt;One more thing worth knowing separately from the caching issue: &lt;CODE data-end="2155" data-start="2135"&gt;st.context.headers&lt;/CODE&gt; itself is only populated once, at the initial page load / WebSocket connection, and doesn't refresh on reruns. So on a long-lived tab, even without any caching bug, the token you're holding can go stale if the underlying session persists across a reconnect. The identity check above catches that case too, since it fails closed instead of quietly running a query under a token that no longer matches.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2026 17:57:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/genie-not-able-to-list-mcp-prompts/m-p/163113#M1945</guid>
      <dc:creator>iyashk-DB</dc:creator>
      <dc:date>2026-07-15T17:57:20Z</dc:date>
    </item>
  </channel>
</rss>

