Skip to main content
Glama

update_collection_item

Update an item in a Skema CMS collection by merging new data with the current fields. Provide the collection name, item ID, and the data to merge.

Instructions

Met à jour un item existant (merge partiel)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesNom de la collection
idYesID de l'item à modifier
dataYesDonnées à mettre à jour

Implementation Reference

  • Main handler for 'update_collection_item' tool. Extracts collection, id, data from args and delegates to skema.updateItem().
    case "update_collection_item": {
      const { collection, id, data } = args as {
        collection: string;
        id: string;
        data: Record<string, unknown>;
      };
      result = await skema.updateItem(collection, id, data);
      break;
  • Input schema definition for 'update_collection_item' tool: requires collection (string), id (string), data (object).
    {
      name: "update_collection_item",
      description: "Met à jour un item existant (merge partiel)",
      inputSchema: {
        type: "object",
        properties: {
          collection: {
            type: "string",
            description: "Nom de la collection",
          },
          id: {
            type: "string",
            description: "ID de l'item à modifier",
          },
          data: {
            type: "object",
            description: "Données à mettre à jour",
          },
        },
        required: ["collection", "id", "data"],
      },
    },
    {
      name: "delete_collection_item",
      description: "Supprime un item d'une collection",
  • Helper function 'updateItem' that calls the remote MCP API with method 'update_collection_item' and parameters collection, id, data.
    /**
     * Met a jour un item
     */
    export const updateItem = (
      collection: string,
      id: string,
      data: Record<string, unknown>
    ) =>
      mcpCall("update_collection_item", { collection, id, data });
  • The mcpCall function is the underlying transport helper that sends JSON-RPC requests to the Skema API. It is used by updateItem to make the actual HTTP call.
    export const mcpCall = async <T = unknown>(
      toolName: string,
      args: Record<string, unknown> = {}
    ): Promise<T> => {
      requestId++;
    
      const response = await fetch(`${BASE_URL}/mcp`, {
        method: "POST",
        headers: {
          "X-API-Key": API_KEY,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          jsonrpc: "2.0",
          id: requestId,
          method: "tools/call",
          params: {
            name: toolName,
            arguments: args,
          },
        }),
      });
    
      if (!response.ok) {
        const error = await response
          .json()
          .catch(() => ({ message: "Erreur inconnue" }));
        throw new Error(error.message || `Erreur HTTP ${response.status}`);
      }
    
      const jsonRpc: JsonRpcResponse<T> = await response.json();
    
      if (jsonRpc.error) {
        throw new Error(jsonRpc.error.message);
      }
    
      if (!jsonRpc.result?.content?.[0]?.text) {
        throw new Error("Reponse MCP invalide");
      }
    
      return JSON.parse(jsonRpc.result.content[0].text);
    };
    
    /**
     * Recupere la liste des collections
     */
    export const getCollections = () => mcpCall("get_collections");
    
    /**
     * Recupere le schema d'une collection
     */
    export const getCollection = (collection: string) =>
      mcpCall("get_collection", { collection });
    
    /**
     * Liste les items d'une collection
     */
    export const getItems = (
      collection: string,
      options?: {
        page?: number;
        perPage?: number;
        sort?: string;
        populate?: string;
        filters?: Record<string, unknown>;
      }
    ) =>
      mcpCall("get_collection_items", {
        collection,
        page: options?.page,
        perPage: options?.perPage,
        sort: options?.sort,
        populate: options?.populate,
        filters: options?.filters,
      });
    
    /**
     * Recupere un item par son ID
     */
    export const getItem = (
      collection: string,
      id: string,
      options?: { populate?: string }
    ) =>
      mcpCall("get_collection_item", {
        collection,
        id,
        populate: options?.populate,
      });
    
    /**
     * Cree un nouvel item
     */
    export const createItem = (collection: string, data: Record<string, unknown>) =>
      mcpCall("create_collection_item", { collection, data });
    
    /**
     * Met a jour un item
     */
    export const updateItem = (
      collection: string,
      id: string,
      data: Record<string, unknown>
    ) =>
      mcpCall("update_collection_item", { collection, id, data });
    
    /**
     * Supprime un item
     */
    export const deleteItem = (collection: string, id: string) =>
      mcpCall("delete_collection_item", { collection, id });
    
    /**
     * Recherche dans une collection
     */
    export const searchItems = (
      collection: string,
      query: string,
      options?: { fields?: string; page?: number; perPage?: number }
    ) =>
      mcpCall("search_collection_items", {
Behavior2/5

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

No annotations are provided, so the description must convey behavior. It only states 'partial merge', implying a patch operation, but does not disclose idempotency, authorization needs, or side effects. Minimal disclosure.

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?

The description is a single, efficient sentence with no redundancy. It is front-loaded with the key action and resource. Could be slightly more detailed without being wasteful.

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 the lack of output schema and annotations, the description is insufficient. It does not explain return values, error handling, or operation details. A more complete description would include behavioral context.

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 coverage is 100% with descriptions for all three parameters (collection, id, data). The description adds the context of 'partial merge' but does not enhance parameter meaning beyond the schema. Baseline 3 applies.

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 verb 'Met à jour' (updates) and the resource 'un item existant', and adds 'merge partiel' distinguishing it from full replacement or creation. This differentiates it from sibling tools like create_collection_item and batch_update_items.

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 this tool versus alternatives like batch_update_items or create_collection_item. The description does not specify prerequisites, context, or situations where this tool is preferred.

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

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