Skip to main content
Glama
getPatternDetails.tsโ€ข1.17 kB
import Ravelry from '@/class/ravelry.class'; import { mcpServer } from '@/index'; import { z } from 'zod'; mcpServer.tool( 'get-pattern-details', 'Retrieve details of a pattern on Ravelry', { id: z.string().describe('Id of the pattern to be retrieved'), }, async ({ id }) => { const ravelryInstance = new Ravelry( process.env.AUTH_USER as string, process.env.AUTH_PASS as string, ); try { const patterns = await ravelryInstance.getPatternDetails(parseInt(id)); if (!patterns) { return { isError: true, content: [{ type: 'text', text: 'No pattern found' }], }; } const response = { ...patterns, pattern_categories: '', pattern_attributes: '', pattern_author: '', photos: '', pattern_type: '', printings: '', packs: '', }; return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }], }; } catch (error) { return { isError: true, content: [{ type: 'text', text: 'Failure while fetching details for a patterns' }], }; } }, );

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/gpaul-mcp/MCP_ravelry'

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