Skip to main content
Glama
elmapicms

elmapicms-mcp-server

Official
by elmapicms

Get Asset

get_asset

Retrieve assets from ElmapiCMS using UUID or filename to access media files and documents stored in the content management system.

Instructions

Get an asset by its UUID or by filename

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesAsset UUID or filename
by_nameNoIf true, looks up by filename instead of UUID

Implementation Reference

  • The complete registration and handler implementation of get_asset tool. It registers the tool with title, description, input schema, and an async handler that fetches assets by UUID or filename using client.get()
    server.registerTool("get_asset", {
      title: "Get Asset",
      description: "Get an asset by its UUID or by filename",
      inputSchema: {
        identifier: z
          .string()
          .describe("Asset UUID or filename"),
        by_name: z
          .boolean()
          .optional()
          .describe("If true, looks up by filename instead of UUID"),
      },
    }, async ({ identifier, by_name }) => {
      const path = by_name
        ? `/files/name/${identifier}`
        : `/files/${identifier}`;
      const result = await client.get(path);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    });
  • Input schema definition for get_asset tool with 'identifier' (string - Asset UUID or filename) and optional 'by_name' (boolean - if true, looks up by filename instead of UUID) parameters
    inputSchema: {
      identifier: z
        .string()
        .describe("Asset UUID or filename"),
      by_name: z
        .boolean()
        .optional()
        .describe("If true, looks up by filename instead of UUID"),
    },
  • src/index.ts:39-39 (registration)
    Registration point where registerAssetTools function is called to register the get_asset tool along with other asset tools
    registerAssetTools(server, client);
  • The get() helper method used by get_asset handler. Constructs URL with base URL and optional query parameters, makes authenticated GET request with proper headers, and handles response parsing
    async get(
      path: string,
      params?: Record<string, unknown>
    ): Promise<unknown> {
      const url = new URL(`${this.baseUrl}${path}`);
      if (params) {
        const flatPairs = this.flattenParams(params);
        for (const [key, value] of flatPairs) {
          url.searchParams.append(key, value);
        }
      }
    
      const response = await fetch(url.toString(), {
        method: "GET",
        headers: this.headers(),
      });
    
      return this.handleResponse(response);
    }

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

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