Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
5e0db17
1
Parent(s): 743f189
Update failing tests
Browse files
tests/tools/test_tool.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import json
|
| 2 |
from dataclasses import dataclass
|
| 3 |
-
from typing import Annotated, Any
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
from mcp.types import (
|
|
@@ -11,6 +11,7 @@ from mcp.types import (
|
|
| 11 |
TextResourceContents,
|
| 12 |
)
|
| 13 |
from pydantic import AnyUrl, BaseModel, Field, TypeAdapter
|
|
|
|
| 14 |
|
| 15 |
from fastmcp.tools.tool import Tool, _convert_to_content
|
| 16 |
from fastmcp.utilities.types import Audio, File, Image
|
|
|
|
| 1 |
import json
|
| 2 |
from dataclasses import dataclass
|
| 3 |
+
from typing import Annotated, Any
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
from mcp.types import (
|
|
|
|
| 11 |
TextResourceContents,
|
| 12 |
)
|
| 13 |
from pydantic import AnyUrl, BaseModel, Field, TypeAdapter
|
| 14 |
+
from typing_extensions import TypedDict
|
| 15 |
|
| 16 |
from fastmcp.tools.tool import Tool, _convert_to_content
|
| 17 |
from fastmcp.utilities.types import Audio, File, Image
|
tests/tools/test_tool_transform.py
CHANGED
|
@@ -254,7 +254,7 @@ async def test_forward_raw_without_argument_mapping(add_tool):
|
|
| 254 |
|
| 255 |
|
| 256 |
async def test_custom_fn_with_kwargs_and_no_transform_args(add_tool):
|
| 257 |
-
async def custom_fn(extra: int, **kwargs) ->
|
| 258 |
sum = await forward(**kwargs)
|
| 259 |
return int(sum.content[0].text) + extra # type: ignore[attr-defined]
|
| 260 |
|
|
@@ -1216,10 +1216,10 @@ class TestTransformToolOutputSchema:
|
|
| 1216 |
):
|
| 1217 |
"""Test transformation handling of mixed content types."""
|
| 1218 |
|
| 1219 |
-
async def custom_fn(x: int)
|
| 1220 |
# Return mixed content including ToolResult
|
| 1221 |
if x == 1:
|
| 1222 |
-
return ["text", {"data": x}]
|
| 1223 |
else:
|
| 1224 |
# Return ToolResult directly
|
| 1225 |
return ToolResult(
|
|
|
|
| 254 |
|
| 255 |
|
| 256 |
async def test_custom_fn_with_kwargs_and_no_transform_args(add_tool):
|
| 257 |
+
async def custom_fn(extra: int, **kwargs) -> int:
|
| 258 |
sum = await forward(**kwargs)
|
| 259 |
return int(sum.content[0].text) + extra # type: ignore[attr-defined]
|
| 260 |
|
|
|
|
| 1216 |
):
|
| 1217 |
"""Test transformation handling of mixed content types."""
|
| 1218 |
|
| 1219 |
+
async def custom_fn(x: int):
|
| 1220 |
# Return mixed content including ToolResult
|
| 1221 |
if x == 1:
|
| 1222 |
+
return ["text", {"data": x}]
|
| 1223 |
else:
|
| 1224 |
# Return ToolResult directly
|
| 1225 |
return ToolResult(
|