mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-20 20:44:17 +02:00
Match functions and methods
This commit is contained in:
parent
010170337f
commit
794ef3f114
4 changed files with 7 additions and 6 deletions
|
|
@ -112,7 +112,7 @@ class Prompt(BaseModel):
|
|||
description = description or fn.__doc__
|
||||
|
||||
# if the fn is a callable class, we need to get the __call__ method from here out
|
||||
if not inspect.isfunction(fn):
|
||||
if not inspect.isroutine(fn):
|
||||
fn = fn.__call__
|
||||
|
||||
type_adapter = get_cached_typeadapter(fn)
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class ResourceTemplate(BaseModel):
|
|||
|
||||
description = description or fn.__doc__ or ""
|
||||
|
||||
if not inspect.isfunction(fn):
|
||||
if not inspect.isroutine(fn):
|
||||
fn = fn.__call__
|
||||
|
||||
type_adapter = get_cached_typeadapter(fn)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class Tool(BaseModel):
|
|||
func_doc = description or fn.__doc__ or ""
|
||||
|
||||
# if the fn is a callable class, we need to get the __call__ method from here out
|
||||
if not inspect.isfunction(fn):
|
||||
if not inspect.isroutine(fn):
|
||||
fn = fn.__call__
|
||||
|
||||
type_adapter = get_cached_typeadapter(fn)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from fastmcp.utilities.tests import temporary_settings
|
|||
|
||||
class TestTemporarySettings:
|
||||
def test_temporary_settings(self):
|
||||
with temporary_settings(log_level="DEBUG"):
|
||||
assert fastmcp.settings.settings.log_level == "DEBUG"
|
||||
assert fastmcp.settings.settings.log_level == "INFO"
|
||||
assert fastmcp.settings.settings.log_level == "DEBUG"
|
||||
with temporary_settings(log_level="ERROR"):
|
||||
assert fastmcp.settings.settings.log_level == "ERROR"
|
||||
assert fastmcp.settings.settings.log_level == "DEBUG"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue