Skip to main content
Glama

get-library-templates

Retrieve all available image templates from Orshot's library to use with your API key for generating customized images.

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

  • The handler function for the 'get-library-templates' tool. It fetches the list of library templates from the Orshot API endpoint '/v1/templates' using the provided API key (or environment variable), processes the response, formats a readable list including template details and modifications, and returns it as MCP content. Handles errors and empty lists gracefully.
        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'}`,
              },
            ],
          };
        }
      }
  • Input schema for the 'get-library-templates' tool using Zod. Defines an optional 'apiKey' string parameter.
      apiKey: z.string().optional().describe("Orshot API key for authentication (optional if set in environment)"),
    },
    async (args) => {
  • src/index.ts:1080-1160 (registration)
    Registration of the 'get-library-templates' tool on the MCP server using server.tool(). Includes the tool name, description, input schema, and inline handler function.
      "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'}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions authentication via API key but doesn't describe what 'Get all available' entails—whether it returns a list, paginated results, error conditions, or rate limits. For a read operation with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It front-loads the core purpose ('Get all available library templates') and adds necessary context about authentication. Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one optional parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and authentication but lacks details on return format, error handling, or usage context relative to siblings. For a simple read tool, this is borderline viable but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single optional 'apiKey' parameter. The description adds marginal value by noting it's for authentication and optional if set in environment, but this is largely redundant with the schema's description. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('all available library templates'), specifying it's for the user using their API key. It distinguishes from sibling 'get-studio-templates' by focusing on library templates, but doesn't explicitly contrast with other siblings like 'generate-image-from-library'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'get-library-templates' over 'get-studio-templates' or 'generate-image-from-library', nor does it specify prerequisites or exclusions beyond the implied authentication context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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