Skip to main content
Glama

deleteItem

Remove a specific item from a collection in Directus CMS by specifying the collection name and item ID, using the MCP Server to execute the deletion via an API call.

Instructions

Delete an item from a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
idYesItem ID
tokenNoAuthentication token (default from config)
urlNoDirectus API URL (default from config)

Implementation Reference

  • The handler logic for deleteItem tool, which performs a DELETE request to the Directus API to remove the specified item from the collection.
    case "deleteItem": {
      const token = toolArgs.token || CONFIG.DIRECTUS_ACCESS_TOKEN;
      const collection = toolArgs.collection as string;
      const id = toolArgs.id as string | number;
      
      await axios.delete(
        `${url}/items/${collection}/${id}`,
        { headers: buildHeaders(token) }
      );
      
      return {
        content: [
          {
            type: "text",
            text: "Item deleted successfully"
          }
        ]
      };
    }
  • The input schema defining parameters for the deleteItem tool, including collection and id as required fields.
    {
      name: "deleteItem",
      description: "Delete an item from a collection",
      inputSchema: {
        type: "object",
        properties: {
          url: { 
            type: "string", 
            description: "Directus API URL (default from config)"
          },
          token: { 
            type: "string", 
            description: "Authentication token (default from config)"
          },
          collection: { 
            type: "string", 
            description: "Collection name"
          },
          id: { 
            type: "string", 
            description: "Item ID"
          }
        },
        required: ["collection", "id"]
      }
    },
  • Helper function to build HTTP headers with authentication token, used by the deleteItem handler.
    const buildHeaders = (token: string): Record<string, string> => {
      return {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${token}`
      };
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Delete' implies a destructive mutation, the description doesn't specify whether this operation is reversible, what permissions are required, or any rate limits. It also doesn't describe the response format or error handling, which is a significant gap for a mutation tool with zero annotation coverage.

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: 'Delete an item from a collection.' It is front-loaded with the core action and resource, with zero wasted words. Every part of the sentence earns its place by conveying the essential purpose without redundancy or fluff.

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?

Given that this is a destructive mutation tool with no annotations and no output schema, the description is incomplete. It fails to address critical aspects like authentication needs, side effects, error conditions, or return values. For a tool with 4 parameters and significant behavioral implications, the description should provide more context to ensure safe and correct usage.

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 input schema already documents all parameters (collection, id, token, url) with clear descriptions. The description adds no additional meaning beyond what the schema provides, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

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

Purpose3/5

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

The description 'Delete an item from a collection' clearly states the verb ('Delete') and resource ('an item from a collection'), which is adequate. However, it doesn't distinguish this tool from its sibling 'updateItem' or 'createItem' in terms of destructive nature, nor does it specify what type of 'item' or 'collection' this refers to (e.g., database records). This makes it somewhat vague compared to more specific alternatives.

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 like 'updateItem' or 'createItem', nor does it mention prerequisites such as authentication or specific contexts. It lacks explicit when/when-not instructions or references to sibling tools, leaving usage unclear beyond the basic action stated.

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

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/pixelsock/directus-mcp'

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