fastmcp/tests
Marcus Shu 2d7bc4e73d
Add encoding parameter to FileResource (#3580)
* feat: Add encoding parameter to FileResource

- Add optional encoding field (str | None, default None) to FileResource.
- Pass encoding through to read_text() for cross-platform text file reading.
- Preserve backward compatibility by defaulting to system encoding.

* test: Add tests for FileResource encoding parameter

- Test UTF-8 reading with explicit encoding for non-ASCII content.
- Test backward compatibility when no encoding is specified.
- Test that encoding is ignored for binary file reads.
- Test Latin-1 reading with matching encoding.

* docs: Document FileResource encoding parameter

- Add encoding="utf-8" to FileResource example in resource classes guide.
- Update FileResource description to mention encoding support.

* feat: Change FileResource encoding default from None to utf-8

- Default to utf-8 instead of system encoding to prevent cross-platform footgun.
- Update field description to reflect new default.
- Update test to verify default encoding is utf-8 with non-ASCII content.
- Remove redundant encoding="utf-8" from docs example since it is now the default.
2026-03-22 09:55:16 -04:00
..
cli fix: validate server names in install commands (#3522) 2026-03-15 14:54:24 -04:00
client fix: store absolute token expiry to prevent stale expires_in on reload (#3572) 2026-03-21 12:12:50 -04:00
contrib fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
deprecated fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
experimental fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
fs fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
integration_tests Update repository references for transfer to prefecthq (#3207) 2026-02-18 10:33:56 -05:00
prompts fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
resources Add encoding parameter to FileResource (#3580) 2026-03-22 09:55:16 -04:00
server fix: increase sleep duration in proxy cache tests (#3567) 2026-03-21 11:38:58 -04:00
telemetry Use standard traceparent/tracestate keys per OTel MCP semconv (#3221) 2026-02-18 15:51:24 -05:00
tools fix: suppress output schema for ToolResult subclass annotations (#3548) 2026-03-18 15:22:37 -04:00
utilities fix: preserve tool properties named 'title' during schema compression (#3582) 2026-03-22 09:48:20 -04:00
__init__.py Update type handling for resources 2024-11-29 19:42:46 -05:00
conftest.py Expose minimum_check_interval, reduce task pickup latency (#3500) 2026-03-14 16:08:28 -04:00
test_apps.py Rename ui= to app= and consolidate ToolUI/ResourceUI into AppConfig (#3117) 2026-02-08 20:26:47 -05:00
test_apps_prefab.py fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
test_fastmcp_app.py Comprehensive MCP Apps docs, string CallTool resolution (#3575) 2026-03-21 19:44:11 -04:00
test_json_schema_generation.py fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
test_mcp_config.py Graceful degradation for multi-server proxy setup (#3546) 2026-03-18 15:25:56 -04:00