Skip to main content
Glama
microcmsio

microCMS MCP Server

by microcmsio

microcms_delete_media

Delete media files (images or documents) from microCMS by providing the file URL. Removes unused media assets from the content management system.

Instructions

Delete media files from microCMS (Management API). Supports deletion of both images and files. Requires media deletion permissions. Note: Media referenced by content cannot be deleted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the media to delete (e.g., "https://images.microcms-assets.io/assets/xxxxx/yyyyy/hoge.jpg" or "https://files.microcms-assets.io/assets/xxxxx/yyyyy/hoge.pdf"). Custom domain URLs are also supported.

Implementation Reference

  • The main handler function for the 'microcms_delete_media' tool. Extracts the 'url' from parameters, validates it, and delegates to the deleteMedia helper function.
    export async function handleDeleteMedia(params: MediaToolParameters & { url: string }) {
      const { url } = params;
    
      if (!url) {
        throw new Error('url is required');
      }
    
      return await deleteMedia(url);
    }
  • Tool definition object including the name 'microcms_delete_media', description, and input schema specifying the required 'url' parameter.
    export const deleteMediaTool: Tool = {
      name: 'microcms_delete_media',
      description: 'Delete media files from microCMS (Management API). Supports deletion of both images and files. Requires media deletion permissions. Note: Media referenced by content cannot be deleted.',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL of the media to delete (e.g., "https://images.microcms-assets.io/assets/xxxxx/yyyyy/hoge.jpg" or "https://files.microcms-assets.io/assets/xxxxx/yyyyy/hoge.pdf"). Custom domain URLs are also supported.',
          },
        },
        required: ['url'],
      },
    };
  • Core helper function that executes the DELETE request to the microCMS Management API to delete the media file specified by URL, using the configured API key and service domain.
    export async function deleteMedia(mediaUrl: string): Promise<{ id: string }> {
      const url = `https://${config.serviceDomain}.microcms-management.io/api/v2/media?url=${encodeURIComponent(mediaUrl)}`;
    
      const response = await fetch(url, {
        method: 'DELETE',
        headers: {
          'X-MICROCMS-API-KEY': config.apiKey,
        },
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`Failed to delete media: ${response.status} ${response.statusText} - ${errorText}`);
      }
    
      return await response.json();
    }
  • src/server.ts:130-132 (registration)
    Server switch case registration that dispatches calls to the 'microcms_delete_media' tool to the handleDeleteMedia handler function.
    case 'microcms_delete_media':
      result = await handleDeleteMedia(params as unknown as MediaToolParameters & { url: string });
      break;
  • src/server.ts:66-66 (registration)
    Inclusion of the deleteMediaTool in the list of tools returned by the ListTools handler.
    deleteMediaTool,
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: it's a destructive operation ('Delete'), requires specific permissions ('Requires media deletion permissions'), and has a critical constraint ('Media referenced by content cannot be deleted'). This covers safety and limitations well, though it lacks details on error handling or response format.

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 front-loaded with the core purpose in the first sentence, followed by supporting details in subsequent sentences. Each sentence adds essential information (media types, permissions, constraints) with zero waste, making it highly efficient and well-structured.

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

Completeness4/5

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

Given the tool's complexity (destructive operation with permissions and constraints), no annotations, and no output schema, the description is largely complete. It covers purpose, usage context, and key behavioral traits. However, it does not describe the return value or error responses, which would be helpful for a deletion tool, leaving a minor gap.

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?

The input schema has 100% description coverage, fully documenting the single 'url' parameter with examples and custom domain support. The description does not add any parameter-specific information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without extra value.

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

Purpose5/5

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

The description clearly states the specific action ('Delete media files') and resource ('from microCMS (Management API)'), distinguishing it from sibling tools like microcms_delete_content (which deletes content) and microcms_upload_media (which uploads media). It explicitly mentions the types of media supported ('both images and files'), providing precise scope.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('Delete media files from microCMS') and includes an important exclusion ('Media referenced by content cannot be deleted'), which helps avoid misuse. However, it does not explicitly compare with alternatives like microcms_delete_content or specify prerequisites beyond permissions, leaving some guidance implicit.

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

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