mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 13:34:17 +02:00
Use isawaitable instead of iscoroutine
This commit is contained in:
parent
84adbbc544
commit
3c6cfe7e7e
3 changed files with 3 additions and 3 deletions
|
|
@ -329,7 +329,7 @@ class FunctionPrompt(Prompt):
|
|||
|
||||
# Call function and check if result is a coroutine
|
||||
result = self.fn(**kwargs)
|
||||
if inspect.iscoroutine(result):
|
||||
if inspect.isawaitable(result):
|
||||
result = await result
|
||||
|
||||
# Validate messages
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class FunctionResource(Resource):
|
|||
kwargs[context_kwarg] = get_context()
|
||||
|
||||
result = self.fn(**kwargs)
|
||||
if inspect.iscoroutinefunction(self.fn):
|
||||
if inspect.isawaitable(result):
|
||||
result = await result
|
||||
|
||||
if isinstance(result, Resource):
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ class FunctionResourceTemplate(ResourceTemplate):
|
|||
kwargs[context_kwarg] = get_context()
|
||||
|
||||
result = self.fn(**kwargs)
|
||||
if inspect.iscoroutine(result):
|
||||
if inspect.isawaitable(result):
|
||||
result = await result
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue