fastmcp/docs
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
..
.cursor/rules Clean up parameter documentation 2025-06-22 20:59:53 -04:00
apps Comprehensive MCP Apps docs, string CallTool resolution (#3575) 2026-03-21 19:44:11 -04:00
assets Animated (#3231) 2026-02-19 11:56:51 -05:00
cli Add fastmcp dev apps command with browser UI preview (#3489) 2026-03-14 12:29:37 -04:00
clients Add verify parameter for SSL certificate configuration (#3487) 2026-03-14 11:48:32 -04:00
community Normalize repo references to PrefectHQ/fastmcp casing (#3218) 2026-02-18 14:51:18 -05:00
css Update docs banner and fix mobile layout 2026-03-03 14:34:49 -05:00
deployment move stateless_http transport kwarg to http_app as FastMCP constructor no longer supports stateless_http as kwarg (#3510) 2026-03-15 11:51:43 -04:00
development Restructure docs navigation: CLI section, Composition, More (#3361) 2026-03-02 21:09:48 -05:00
getting-started Restructure docs navigation: CLI section, Composition, More (#3361) 2026-03-02 21:09:48 -05:00
integrations Restructure docs navigation: CLI section, Composition, More (#3361) 2026-03-02 21:09:48 -05:00
more perf: reduce PBKDF2 iterations in tests, fix warnings and timeouts (#3504) 2026-03-14 16:42:06 -04:00
patterns Normalize repo references to PrefectHQ/fastmcp casing (#3218) 2026-02-18 14:51:18 -05:00
public/schemas/fastmcp.json chore: Update fastmcp.json schema (#1955) 2025-09-29 20:12:24 -04:00
python-sdk chore: Update SDK documentation (#3551) 2026-03-18 18:48:36 -04:00
servers Add encoding parameter to FileResource (#3580) 2026-03-22 09:55:16 -04:00
snippets Reorganize docs around provider architecture (#2723) 2025-12-25 09:00:20 -05:00
tutorials Remove trailing slashes from MCP endpoint URLs in docs (#2277) 2025-10-27 10:36:47 -04:00
v2 Remove system role references from docs (#3356) 2026-03-02 16:36:24 -05:00
.ccignore Add comprehensive OAuth 2.1 authentication system with WorkOS integration (#1327) 2025-08-01 17:06:55 -04:00
changelog.mdx Add v3.0.2 release notes (#3276) 2026-02-22 11:41:37 -05:00
docs.json Comprehensive MCP Apps docs, string CallTool resolution (#3575) 2026-03-21 19:44:11 -04:00
unify-intent.js Add tag to docs 2026-03-03 19:06:11 -05:00
updates.mdx Add v3.0.2 release notes (#3276) 2026-02-22 11:41:37 -05:00
v2-banner.js Update docs for 3.0 GA release (#3216) 2026-02-18 14:29:28 -05:00