Loading...
;
return (
{resource.contents.map((content, i) => (
{content.text &&
{content.text}}
{content.blob && (

)}
))}
);
}
```
## Combining Registration Methods
You can combine static resources with dynamic functions for maximum flexibility:
```tsx
import { TamboRegistryProvider } from "@tambo-ai/react";
// Static resources that are always available
const staticResources = [
{
uri: "docs://privacy-policy",
name: "Privacy Policy",
mimeType: "text/plain",
},
];
// Dynamic function to list all resources (static + dynamic)
const listResources = async (search?: string) => {
const dynamicDocs = await fetchUserDocuments();
const allResources = [
...staticResources,
...dynamicDocs.map((doc) => ({
uri: `user-docs://${doc.id}`,
name: doc.title,
mimeType: "text/plain",
})),
];
if (search) {
return allResources.filter((r) =>
r.name.toLowerCase().includes(search.toLowerCase()),
);
}
return allResources;
};
const getResource = async (uri: string) => {
if (uri === "docs://privacy-policy") {
return {
contents: [
{ uri, mimeType: "text/plain", text: "Privacy policy text..." },
],
};
}
// Handle dynamic resources
const doc = await fetchDocument(uri);
return {
contents: [{ uri, mimeType: "text/plain", text: doc.content }],
};
};