mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-16 02:29:11 +02:00
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> |
||
|---|---|---|
| .. | ||
| json_schema_type | ||
| openapi | ||
| __init__.py | ||
| test_async_utils.py | ||
| test_auth.py | ||
| test_callable_utils.py | ||
| test_cli.py | ||
| test_components.py | ||
| test_docstring_parsing.py | ||
| test_inspect.py | ||
| test_inspect_icons.py | ||
| test_json_schema.py | ||
| test_logging.py | ||
| test_skills.py | ||
| test_tests.py | ||
| test_token_cache.py | ||
| test_typeadapter.py | ||
| test_types.py | ||
| test_version_check.py | ||