{"record":{"id":"548e8addef79d283","repo":"PrefectHQ/fastmcp","slug":"unsupported-content-type-type-item","errorCode":null,"errorMessage":"Unsupported content type: {type(item)}","messagePattern":"Unsupported content type: (.+?)","errorType":"exception","errorClass":"ResourceError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/server/providers/proxy.py","lineNumber":579,"sourceCode":"            for item in result:\n                if isinstance(item, TextResourceContents):\n                    contents.append(\n                        ResourceContent(\n                            content=item.text,\n                            mime_type=item.mime_type,\n                            meta=item.meta,\n                        )\n                    )\n                elif isinstance(item, BlobResourceContents):\n                    contents.append(\n                        ResourceContent(\n                            content=base64.b64decode(item.blob),\n                            mime_type=item.mime_type,\n                            meta=item.meta,\n                        )\n                    )\n                else:\n                    raise ResourceError(f\"Unsupported content type: {type(item)}\")\n\n            return ResourceResult(contents=contents)\n\n    def get_span_attributes(self) -> dict[str, Any]:\n        return super().get_span_attributes() | {\n            \"fastmcp.provider.type\": \"ProxyProvider\",\n            \"fastmcp.proxy.backend_uri\": self._backend_uri or str(self.uri),\n        }\n\n\nclass ProxyTemplate(ResourceTemplate):\n    \"\"\"A ResourceTemplate that represents and creates resources from a remote server template.\"\"\"\n\n    task_config: TaskConfig = TaskConfig(mode=\"forbidden\")\n    _backend_uri_template: str | None = None\n\n    def __init__(self, client_factory: ClientFactoryT, **kwargs: Any):\n        super().__init__(**kwargs)","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/server/providers/proxy.py#L561-L597","documentation":"ProxyProvider.read() converts MCP content blocks returned by the remote server into FastMCP ResourceContent objects. When the remote resource returns a content block type the proxy does not recognize (not text, and not base64 blob), it raises ResourceError. This guards against silently dropping unknown content from upstream servers.","triggerScenarios":"Calling read() on a proxied resource whose remote ReadResourceResult contains a content block that is neither TextResourceContents (text) nor BlobResourceContents (blob) — e.g. an embedded resource or a custom content type the upstream server emitted.","commonSituations":"Proxying an upstream MCP server that returns EmbeddedResource blocks (e.g. resources-within-resources), or an upstream server using a newer/custom content type your FastMCP version doesn't map yet.","solutions":["Check what content types the upstream server actually returns for that resource URI (raw MCP read_resource call) and make it return plain text or base64 blob content","Upgrade fastmcp to the latest version in case support for additional content types was added","Convert the upstream resource to return text/blob content, or copy the resource locally instead of proxying it"],"exampleFix":"// before: upstream returns an EmbeddedResource block -> proxy raises\n// after: make the upstream resource handler return text\n@mcp.resource('data://x')\ndef get_x() -> str:\n    return json.dumps(data)  # text content instead of embedded resource","handlingStrategy":"type-guard","validationCode":"# before reading through the proxy, check the upstream returns mappable blocks\nresult = await upstream_client.read_resource(uri)\nif not all(getattr(b, 'text', None) is not None or getattr(b, 'blob', None) is not None for b in result):\n    raise ValueError(f'{uri} returns non-text/blob content; proxy cannot map it')","typeGuard":"def is_mappable_content(item) -> bool:\n    return hasattr(item, 'text') or hasattr(item, 'blob')","tryCatchPattern":"from fastmcp.exceptions import ResourceError\ntry:\n    result = await provider.read(uri)\nexcept ResourceError as e:\n    logger.warning('Unmappable upstream content: %s', e)\n    result = fallback_read(uri)","preventionTips":["Prefer upstream resources that return plain text or base64 blob content","Test proxied resources with the real upstream server before production","Keep fastmcp updated for new content-type support"],"tags":["proxy","resource","content-type","mcp"],"backgroundTag":"unsupported-content-type","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}