Skip to main content
Glama
resources.ts1.1 kB
import { FastMCP } from "fastmcp"; /** * Set up FastMCP resources and templates * * @param server FastMCP server instance */ export function setupResources(server: FastMCP): void { try { // Add basic resources server.addResource({ uri: 'status://health', name: "Health Check", mimeType: "text/plain", load: async () => ({ text: "ok" }) }); // Add resource templates - using 'any' to bypass type checking issues with FastMCP const template: any = { uriTemplate: 'task://{id}', name: "Task", mimeType: "application/json", load: async (args: any) => { return { json: { id: args.id, status: "example", description: "Example task resource" } }; } }; server.addResourceTemplate(template); console.error("[INFO] [resources] Resources and templates set up successfully"); } catch (error) { console.error(`[ERROR] [resources] Error setting up resources: ${error instanceof Error ? error.message : String(error)}`); throw error; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flight505/mcp-think-tank'

If you have feedback or need assistance with the MCP directory API, please join our Discord server