Skip to main content
Glama

get-library-templates

Retrieve all available library templates for image generation using your Orshot API key. Simplify the process of accessing and utilizing pre-designed or custom templates for dynamic image creation.

Instructions

Get all available library templates for the user using their API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiKeyNoOrshot API key for authentication (optional if set in environment)

Implementation Reference

  • Handler function that fetches library templates from Orshot API /v1/templates endpoint using the provided or env API key, formats them into a markdown list with details and modifications, and returns as MCP content.
    const { apiKey } = args; const actualApiKey = apiKey || DEFAULT_API_KEY; if (!actualApiKey) { return { content: [ { type: "text", text: "No API key provided. Please provide an API key parameter or set ORSHOT_API_KEY environment variable.", }, ], }; } try { const response = await fetch(`${ORSHOT_API_BASE}/v1/templates`, { method: "GET", headers: { "Authorization": `Bearer ${actualApiKey}`, "Content-Type": "application/json", }, }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const templates = await response.json(); const templateArray = Array.isArray(templates) ? templates : []; if (templateArray.length === 0) { return { content: [ { type: "text", text: "No library templates found for your account.", }, ], }; } const templateList = templateArray.map((template: any, index: number) => { const modifications = template.modifications || []; const modificationsList = modifications.length > 0 ? modifications.map((mod: any) => ` - ${mod.key}: ${mod.description || 'No description'}`).join('\n') : ' - No modifications available'; return `${index + 1}. **${template.title || 'Untitled'}** ID: ${template.id} Description: ${template.description || 'No description'} Available Modifications: ${modificationsList}`; }).join('\n\n'); return { content: [ { type: "text", text: `Found ${templateArray.length} library template(s):\n\n${templateList}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to fetch library templates: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }
  • Zod schema defining the input parameters for the tool: optional apiKey string.
    apiKey: z.string().optional().describe("Orshot API key for authentication (optional if set in environment)"), }, async (args) => {
  • src/index.ts:1080-1160 (registration)
    MCP server tool registration for 'get-library-templates' with description, input schema, and handler reference.
    "get-library-templates", "Get all available library templates for the user using their API key", { apiKey: z.string().optional().describe("Orshot API key for authentication (optional if set in environment)"), }, async (args) => { const { apiKey } = args; const actualApiKey = apiKey || DEFAULT_API_KEY; if (!actualApiKey) { return { content: [ { type: "text", text: "No API key provided. Please provide an API key parameter or set ORSHOT_API_KEY environment variable.", }, ], }; } try { const response = await fetch(`${ORSHOT_API_BASE}/v1/templates`, { method: "GET", headers: { "Authorization": `Bearer ${actualApiKey}`, "Content-Type": "application/json", }, }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const templates = await response.json(); const templateArray = Array.isArray(templates) ? templates : []; if (templateArray.length === 0) { return { content: [ { type: "text", text: "No library templates found for your account.", }, ], }; } const templateList = templateArray.map((template: any, index: number) => { const modifications = template.modifications || []; const modificationsList = modifications.length > 0 ? modifications.map((mod: any) => ` - ${mod.key}: ${mod.description || 'No description'}`).join('\n') : ' - No modifications available'; return `${index + 1}. **${template.title || 'Untitled'}** ID: ${template.id} Description: ${template.description || 'No description'} Available Modifications: ${modificationsList}`; }).join('\n\n'); return { content: [ { type: "text", text: `Found ${templateArray.length} library template(s):\n\n${templateList}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to fetch library templates: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } );

Other Tools

Related Tools

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/rishimohan/orshot-mcp-server'

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