Skip to main content
Glama
elmapicms

elmapicms-mcp-server

Official
by elmapicms

List Assets

list_assets

List assets in your project with pagination to browse and manage media files.

Instructions

List assets in the project with optional pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number
per_pageNoItems per page

Implementation Reference

  • Handler function for the list_assets tool. Accepts optional page/per_page pagination params, makes a GET request to /files via the ElmapiClient, and returns the result as JSON text.
    server.registerTool("list_assets", {
      title: "List Assets",
      description: "List assets in the project with optional pagination",
      inputSchema: {
        page: z.number().optional().describe("Page number"),
        per_page: z.number().optional().describe("Items per page"),
      },
    }, async ({ page, per_page }) => {
      const params: Record<string, string> = {};
      if (page) params.page = String(page);
      if (per_page) params.per_page = String(per_page);
    
      const result = await client.get("/files", params);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    });
  • Input schema for list_assets using Zod: optional page and per_page number fields.
    inputSchema: {
      page: z.number().optional().describe("Page number"),
      per_page: z.number().optional().describe("Items per page"),
    },
  • Registration of the list_assets tool via server.registerTool() within the registerAssetTools function.
    server.registerTool("list_assets", {
      title: "List Assets",
      description: "List assets in the project with optional pagination",
      inputSchema: {
        page: z.number().optional().describe("Page number"),
        per_page: z.number().optional().describe("Items per page"),
      },
    }, async ({ page, per_page }) => {
      const params: Record<string, string> = {};
      if (page) params.page = String(page);
      if (per_page) params.per_page = String(per_page);
    
      const result = await client.get("/files", params);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    });
  • src/index.ts:39-39 (registration)
    Top-level registration call that wires up all asset tools including list_assets.
    registerAssetTools(server, client);
  • ElmapiClient.get() helper used by list_assets to perform the GET request to /files with pagination params.
    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);
    }
Behavior2/5

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

No annotations provided. Description does not reveal behavioral details like sorting, max page size, or permission requirements.

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

Conciseness4/5

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

Description is one concise sentence. Could include more details without sacrificing brevity, but no unnecessary information.

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

Completeness2/5

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

No output schema and no annotations. Missing key details like default values, maximum per_page, return format, or error handling. Incomplete for a listing endpoint.

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 has 100% coverage with descriptions for page and per_page. Description adds only the phrase 'optional pagination', which does not significantly enhance understanding.

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?

Description clearly states it lists assets in the project, distinguishing it from CRUD siblings like create_asset, delete_asset, etc. Somewhat generic but sufficient.

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?

No guidance on when to use list_assets vs get_asset or other listing tools. No context about filtering or when pagination is needed.

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

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