Problem
FastMCP will support resource annotations (audience, priority, lastModified) via the @mcp.resource() decorator (see #1468). However, annotations are set once at decoration time and cannot be updated as the server runs.
This is problematic for lastModified especially. If you annotate a file resource, there's no easy way to keep the timestamp current as the file changes:
@mcp.resource("file://docs/readme.md", annotations=Annotations(
audience=["user"],
lastModified="2025-01-12T15:00:58Z"
))
def read_readme() -> str:
return open("readme.md").read()
Once deployed, this annotation is stale. If the file updates tomorrow, clients see outdated metadata.
Solution
Allow annotations to be updated dynamically. Possible approaches:
- Provide a method to update resource annotations at runtime
- Allow annotation callables/lambdas that compute values on each list_resources() call
- Return fresh annotations from resource handler functions
This would enable:
- Accurate lastModified timestamps from file mtimes
- Dynamic audience/priority based on server state
- Better integration with external data sources
Issue written by Claude, reviewed by @maxisbey
Reactions are currently unavailable
Problem
FastMCP will support resource annotations (audience, priority, lastModified) via the @mcp.resource() decorator (see #1468). However, annotations are set once at decoration time and cannot be updated as the server runs.
This is problematic for lastModified especially. If you annotate a file resource, there's no easy way to keep the timestamp current as the file changes:
Once deployed, this annotation is stale. If the file updates tomorrow, clients see outdated metadata.
Solution
Allow annotations to be updated dynamically. Possible approaches:
This would enable:
Issue written by Claude, reviewed by @maxisbey