Skip to content

Field loss in transform and provider create_resource() methods #4052

@strawgate

Description

@strawgate

Field loss in transform and provider create_resource() methods

Summary

Three related bugs where fields are silently dropped when creating resources from templates or providers:

Bug 1: FunctionResourceTemplate.create_resource() drops fields

src/fastmcp/resources/template.py:440-449 creates resources via Resource.from_function() but never passes icons, annotations, meta, or title — even though Resource.from_function accepts these parameters.

Bug 2: FastMCPProviderResourceTemplate.create_resource() drops fields

src/fastmcp/server/providers/fastmcp_provider.py:368-384 has the same issue — creates FastMCPProviderResource without icons, tags, annotations, task_config, meta, title, or auth.

Bug 3: Namespace transform loses original_name

src/fastmcp/server/transforms/namespace.py:100 uses model_copy(update={"name": ...}) to rename tools, but doesn't preserve original_name via fastmcp.delegate.original_name. This is inconsistent with FastMCPProviderTool.wrap() which does preserve the original name.

Impact

  • Icon annotations on resource templates are silently lost
  • Telemetry delegation spans lose fastmcp.delegate.original_name for namespaced tools
  • tags and auth settings on mounted resource templates are ignored

Fix Suggestion

Add icons, annotations, meta, title to the Resource.from_function() call in templates. Add original_name preservation to Namespace transform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.providerRelated to the FastMCP Provider classserverRelated to FastMCP server implementation or server-side functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions