Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/mcp/server/mcpserver/resources/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ async def create_resource(
if isinstance(result, InputRequiredResult):
return result

async def _return_result() -> Any:
return result

return FunctionResource(
uri=uri, # type: ignore
name=self.name,
Expand All @@ -240,7 +243,7 @@ async def create_resource(
icons=self.icons,
annotations=self.annotations,
meta=self.meta,
fn=lambda: result, # Capture result in closure
fn=_return_result,
)
except (ResourceError, MCPError):
raise
Expand Down
Loading