diff --git a/src/fastmcp/prompts/prompt_manager.py b/src/fastmcp/prompts/prompt_manager.py index 47076e7c6..fea5ebcd4 100644 --- a/src/fastmcp/prompts/prompt_manager.py +++ b/src/fastmcp/prompts/prompt_manager.py @@ -60,6 +60,7 @@ class PromptManager: warnings.warn( "PromptManager.add_prompt_from_fn() is deprecated. Use Prompt.from_function() and call add_prompt() instead.", DeprecationWarning, + stacklevel=2, ) prompt = FunctionPrompt.from_function( fn, name=name, description=description, tags=tags diff --git a/src/fastmcp/resources/resource_manager.py b/src/fastmcp/resources/resource_manager.py index 33731d065..b802d7d8c 100644 --- a/src/fastmcp/resources/resource_manager.py +++ b/src/fastmcp/resources/resource_manager.py @@ -125,6 +125,7 @@ class ResourceManager: warnings.warn( "add_resource_from_fn is deprecated. Use Resource.from_function() and call add_resource() instead.", DeprecationWarning, + stacklevel=2, ) resource = Resource.from_function( fn=fn, @@ -181,6 +182,7 @@ class ResourceManager: warnings.warn( "add_template_from_fn is deprecated. Use ResourceTemplate.from_function() and call add_template() instead.", DeprecationWarning, + stacklevel=2, ) template = ResourceTemplate.from_function( fn, diff --git a/src/fastmcp/tools/tool_manager.py b/src/fastmcp/tools/tool_manager.py index 4ac72c78f..a05701a17 100644 --- a/src/fastmcp/tools/tool_manager.py +++ b/src/fastmcp/tools/tool_manager.py @@ -73,6 +73,7 @@ class ToolManager: warnings.warn( "ToolManager.add_tool_from_fn() is deprecated. Use Tool.from_function() and call add_tool() instead.", DeprecationWarning, + stacklevel=2, ) tool = Tool.from_function( fn,