We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fb9ce6 commit 66d459bCopy full SHA for 66d459b
src/mcp/server/fastmcp/resources/types.py
@@ -4,7 +4,7 @@
4
import json
5
from collections.abc import Callable
6
from pathlib import Path
7
-from typing import Any
+from typing import Any, Self
8
9
import anyio
10
import anyio.to_thread
@@ -76,7 +76,7 @@ def from_function(
76
name: str | None = None,
77
description: str | None = None,
78
mime_type: str | None = None,
79
- ):
+ ) -> Self:
80
"""Create a template from a function."""
81
func_name = name or fn.__name__
82
if func_name == "<lambda>":
@@ -87,7 +87,7 @@ def from_function(
87
88
return cls(
89
uri=AnyUrl(uri),
90
- name=name,
+ name=func_name,
91
description=description or fn.__doc__ or "",
92
mime_type=mime_type or "text/plain",
93
fn=fn,
0 commit comments