From b3e9de42b68bf4db6497342ee7e280da69b789d7 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 5 Oct 2026 11:22:44 +0200 Subject: [PATCH] chore(mcp): Replace deprecated mcp.prompt.name with gen_ai.prompt.name --- sentry_sdk/consts.py | 9 +++++++++ sentry_sdk/integrations/mcp.py | 2 +- tests/integrations/fastmcp/test_fastmcp.py | 4 ++-- tests/integrations/mcp/test_mcp.py | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 4c47e4c155..3613f83675 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -576,6 +576,12 @@ class SPANDATA: Example: "qa-pipeline" """ + GEN_AI_PROMPT_NAME = "gen_ai.prompt.name" + """ + The name of the prompt that uniquely identifies it. + Example: "summarize_text" + """ + GEN_AI_RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons" """ The reason why the model stopped generating. @@ -1093,6 +1099,9 @@ class SPANDATA: MCP_PROMPT_NAME = "mcp.prompt.name" """ + .. deprecated:: + This attribute is deprecated. Use GEN_AI_PROMPT_NAME instead. + The name of the MCP prompt being retrieved. Example: "code_review" """ diff --git a/sentry_sdk/integrations/mcp.py b/sentry_sdk/integrations/mcp.py index 0935fd5b1e..f0c0854263 100644 --- a/sentry_sdk/integrations/mcp.py +++ b/sentry_sdk/integrations/mcp.py @@ -343,7 +343,7 @@ async def _instrument_prompt_get( _set_span_input_data( span, handler_name, - SPANDATA.MCP_PROMPT_NAME, + SPANDATA.GEN_AI_PROMPT_NAME, "prompts/get", arguments, request_id, diff --git a/tests/integrations/fastmcp/test_fastmcp.py b/tests/integrations/fastmcp/test_fastmcp.py index ac62d94d8e..2d07750dcc 100644 --- a/tests/integrations/fastmcp/test_fastmcp.py +++ b/tests/integrations/fastmcp/test_fastmcp.py @@ -696,7 +696,7 @@ def code_help_prompt(language: str): span = prompt_spans[0] assert span["attributes"]["sentry.origin"] == "auto.ai.mcp" assert span["name"] == "prompts/get code_help_prompt" - assert span["attributes"][SPANDATA.MCP_PROMPT_NAME] == "code_help_prompt" + assert span["attributes"][SPANDATA.GEN_AI_PROMPT_NAME] == "code_help_prompt" assert SPANDATA.MCP_PROMPT_RESULT_MESSAGE_CONTENT in span["attributes"] @@ -763,7 +763,7 @@ def code_help_prompt(language: str): span = prompt_spans[0] assert span["attributes"]["sentry.origin"] == "auto.ai.mcp" assert span["name"] == "prompts/get code_help_prompt" - assert span["attributes"][SPANDATA.MCP_PROMPT_NAME] == "code_help_prompt" + assert span["attributes"][SPANDATA.GEN_AI_PROMPT_NAME] == "code_help_prompt" assert SPANDATA.MCP_PROMPT_RESULT_MESSAGE_CONTENT not in span["attributes"] diff --git a/tests/integrations/mcp/test_mcp.py b/tests/integrations/mcp/test_mcp.py index 39dda20602..9868b94482 100644 --- a/tests/integrations/mcp/test_mcp.py +++ b/tests/integrations/mcp/test_mcp.py @@ -703,7 +703,7 @@ async def test_prompt(ctx, params): assert data["sentry.origin"] == "auto.ai.mcp" # Check span data - assert data[SPANDATA.MCP_PROMPT_NAME] == "code_help" + assert data[SPANDATA.GEN_AI_PROMPT_NAME] == "code_help" assert data[SPANDATA.MCP_METHOD_NAME] == "prompts/get" assert data[SPANDATA.MCP_TRANSPORT] == "stdio" assert data[SPANDATA.MCP_REQUEST_ID] == "req-prompt" @@ -776,7 +776,7 @@ async def test_prompt(ctx, params): assert data["sentry.origin"] == "auto.ai.mcp" # Check span data - assert data[SPANDATA.MCP_PROMPT_NAME] == "code_help" + assert data[SPANDATA.GEN_AI_PROMPT_NAME] == "code_help" assert data[SPANDATA.MCP_METHOD_NAME] == "prompts/get" assert data[SPANDATA.MCP_TRANSPORT] == "stdio" assert data[SPANDATA.MCP_REQUEST_ID] == "req-prompt"