Skip to main content
Glama
ReadResources.ts784 B
import type { ReadResourceRequest } from '@modelcontextprotocol/sdk/types.js'; import type { GetArtworkByIdTool } from '../tools/GetArtworkByIdTool'; export class ReadResources { constructor(private getArtworkByIdTool: GetArtworkByIdTool) {} public async handle(request: ReadResourceRequest) { const uri = request.params.uri; if (uri.startsWith('artic-image://')) { const title = uri.split('://')[1]; const image = this.getArtworkByIdTool.imageByTitle.get(title); if (image) { return { contents: [{ uri, mimeType: 'image/jpeg', blob: image, }], }; } } return { content: [{ type: 'text', text: `Resource not found: ${uri}` }], isError: true, }; } }

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/mikechao/artic-mcp'

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