fastmcp/tests/tools
William Easton e3f02374c7 Support functools.partial and centralize callable utilities
functools.partial objects failed at registration (@mcp.tool didn't
recognize them) and at call time (update_wrapper set __wrapped__
causing Pydantic to ignore bound arguments).

Introduces centralized utilities replacing scattered patterns across
11 files:

callable_utils.py:
- is_callable_object(): TypeGuard replacing inspect.isroutine() in
  7 decorator entry points — recognizes partials as callables
- get_callable_name(): Extracts useful names from any callable type,
  including partials without update_wrapper
- prepare_callable(): Strips __wrapped__, unwraps callable classes
  and staticmethod — replaces 4 duplicated blocks

decorators.py:
- set_fastmcp_meta(): Attaches __fastmcp__ metadata through __func__
  for bound methods — replaces 5 identical 2-line blocks

TaskConfig:
- normalize(): Converts bool|TaskConfig|None to TaskConfig — replaces
  4 identical 6-line if/elif/else blocks

No behavior changes beyond the bug fix: existing lambda rejection,
validation, and error handling remain per-module policy.

Closes #3266

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 22:46:13 -05:00
..
tool Support functools.partial and centralize callable utilities 2026-05-12 22:46:13 -05:00
tool_transform fix(tool_transform): hoist $defs to schema root when ArgTransform introduces them (#4101) 2026-05-07 11:10:52 -04:00
__init__.py Support mounting FastMCPs as sub-servers 2025-04-07 17:54:55 -04:00
test_standalone_decorator.py fix: preserve tool decorator metadata (#4072) 2026-05-04 12:22:31 -04:00
test_tool_future_annotations.py fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
test_tool_run_in_thread.py Add run_in_thread opt-out for sync tools with thread affinity (#4010) 2026-04-22 10:31:44 -04:00
test_tool_timeout.py Unify discovery API: deduplicate at protocol layer only (#2919) 2026-01-18 21:01:53 -05:00