fastmcp/tests/tools
Jeremiah Lowin ea1328660e
Fix NameError with future annotations and Context/Depends parameters (#3243)
* Fix NameError with future annotations and Context/Depends parameters

Closes #3238, closes #905

* chore: Update SDK documentation

* Drop unnecessary pre-resolution of annotations

Pydantic (even 2.11.7) uses __module__ not __globals__ to resolve
annotations, so setting __module__ alone is sufficient.

* chore: Update SDK documentation

* Restore annotation pre-resolution for Pydantic compat

The wrapper's __globals__ is read-only and points to dependencies.py,
so some Pydantic versions use it instead of __module__ when resolving
string annotations. Pre-resolving via get_type_hints on the original
function ensures annotations are type objects before Pydantic sees them.

* chore: Update SDK documentation

---------

Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2026-02-20 09:22:10 -05:00
..
tool Make $ref dereferencing optional via FastMCP(dereference_refs=...) (#3151) 2026-02-11 13:45:37 -05:00
tool_transform Accept callables in Tool.from_tool() (#3235) 2026-02-19 11:31:13 -05:00
__init__.py Support mounting FastMCPs as sub-servers 2025-04-07 17:54:55 -04:00
test_standalone_decorator.py Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
test_tool_future_annotations.py Fix NameError with future annotations and Context/Depends parameters (#3243) 2026-02-20 09:22:10 -05:00
test_tool_timeout.py Unify discovery API: deduplicate at protocol layer only (#2919) 2026-01-18 21:01:53 -05:00