Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

1.7 KB
Raw Blame
---
title: prefab_synthesis
sidebarTitle: prefab_synthesis
---

# `fastmcp.server.providers.prefab_synthesis`


On-demand Prefab renderer resources shared by effective configuration.

Tools carry a placeholder UI resource URI. Listings rewrite it to a stable
renderer URI derived from the Prefab version, delivery mode, and effective
resource metadata. Matching tools share a resource; different CSP, permissions,
domains, and border preferences stay distinct. HTML is loaded only on read.
Legacy per-tool URIs remain readable independently of backend tool identity.


## Functions

### `synthesize_prefab_resources` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/server/providers/prefab_synthesis.py#L254" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
synthesize_prefab_resources(server: FastMCP) -> list[Resource]
```


Return one lazy resource per effective renderer configuration.


### `synthesize_prefab_resource_by_uri` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/server/providers/prefab_synthesis.py#L266" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
synthesize_prefab_resource_by_uri(server: FastMCP, uri: str) -> Resource | None
```


Intercept a Prefab renderer URI and synthesize on demand.


### `rewrite_tool_meta_for_wire` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/server/providers/prefab_synthesis.py#L288" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python
rewrite_tool_meta_for_wire(tool: Tool) -> Tool
```


Return a copy with the shared URI and resource-only fields stripped.