fastmcp/tests/resources
Jeremiah Lowin caeaa86394
Simplify .key as computed property (#2648)
* Simplify .key as computed property

Keep .key as the standard lookup interface for all components but
implement it as a computed property instead of a stored field.

- Remove _key private attribute and custom model_copy(key=...)
- .key returns .name for tools/prompts, str(.uri) for resources,
  .uri_template for templates
- Use .key universally for component lookups in managers
- MountedProvider: prefix URIs only for resources/templates, not names
- Docket registration: tools/prompts use .key, resources use .name
  (matches fn.__name__ for function lookup)

* Simplify .key as computed property

Keep .key as the standard lookup interface for all components but
implement it as a computed property instead of a stored field.

- Remove _key private attribute and custom model_copy(key=...)
- .key returns .name for tools/prompts, str(.uri) for resources,
  .uri_template for templates
- Use .key universally for component lookups and Docket registration
- MountedProvider: prefix URIs only for resources/templates, not names
- Add _backend_* fields to proxy classes to preserve original identifiers
  for backend calls when prefixed via import_server

* Standardize .key as computed property

- .key is now a read-only computed property:
  - Tools/Prompts: returns .name
  - Resources: returns str(.uri)
  - Templates: returns .uri_template
- Prefixing uses model_copy(update={...}) to change underlying field
- Resource/template names are NOT prefixed, only URIs
- Move import_server tests to tests/deprecated/
2025-12-18 14:48:47 -05:00
..
__init__.py restore 1.x code 2025-04-09 11:54:42 -04:00
test_file_resources.py Revert "Revert "Refactor resource behavior and add meta support (#2598)" (#2609)" (#2611) 2025-12-14 21:36:40 -05:00
test_function_resources.py Revert "Revert "Refactor resource behavior and add meta support (#2598)" (#2609)" (#2611) 2025-12-14 21:36:40 -05:00
test_resource_manager.py Simplify .key as computed property (#2648) 2025-12-18 14:48:47 -05:00
test_resource_template.py Revert "Revert "Refactor resource behavior and add meta support (#2598)" (#2609)" (#2611) 2025-12-14 21:36:40 -05:00
test_resource_template_meta.py Add meta parameter support to tools, resources, templates, and prompts decorators (#1294) 2025-07-29 17:16:05 -04:00
test_resources.py Allow direct instantiation of Prompt and Resource classes (#2031) 2025-10-08 21:06:41 -04:00