@@ -401,7 +401,11 @@ async def _async_handler_wrapper(
401401
402402 # For resources, extract and set protocol
403403 if handler_type == "resource" :
404- uri = original_args [0 ]
404+ if original_args :
405+ uri = original_args [0 ]
406+ else :
407+ uri = original_kwargs .get ("uri" )
408+
405409 protocol = None
406410 if hasattr (uri , "scheme" ):
407411 protocol = uri .scheme
@@ -623,9 +627,7 @@ def _patch_fastmcp():
623627 original_get_prompt_mcp = FastMCP ._get_prompt_mcp
624628
625629 @wraps (original_get_prompt_mcp )
626- async def patched_get_prompt_mcp (
627- self : "Any" , * args : "Any" , ** kwargs : "Any"
628- ) -> "Any" :
630+ async def patched_get_prompt_mcp (* args : "Any" , ** kwargs : "Any" ) -> "Any" :
629631 return await _async_handler_wrapper (
630632 "prompt" ,
631633 original_get_prompt_mcp ,
@@ -639,9 +641,7 @@ async def patched_get_prompt_mcp(
639641 original_read_resource_mcp = FastMCP ._read_resource_mcp
640642
641643 @wraps (original_read_resource_mcp )
642- async def patched_read_resource_mcp (
643- self : "Any" , * args : "Any" , ** kwargs : "Any"
644- ) -> "Any" :
644+ async def patched_read_resource_mcp (* args : "Any" , ** kwargs : "Any" ) -> "Any" :
645645 return await _async_handler_wrapper (
646646 "resource" ,
647647 original_read_resource_mcp ,
0 commit comments