Skip to main content
Glama
nickweedon

Skeleton MCP Server

by nickweedon

update_item

Modify existing items by updating their name, description, or metadata fields using the item's unique identifier.

Instructions

Update an existing item.

Args: item_id: The unique identifier of the item to update name: New name (optional) description: New description (optional) metadata: New metadata (optional, replaces existing)

Returns: The updated item data

Raises: ValueError: If the item is not found

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_idYes
nameNo
descriptionNo
metadataNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'update_item' tool. It updates an existing item in the mock data store by ID, allowing optional updates to name, description, and metadata. Updates the 'updated_at' timestamp and returns the modified item.
    async def update_item(
        item_id: str,
        name: str | None = None,
        description: str | None = None,
        metadata: dict[str, str] | None = None,
    ) -> dict[str, Any]:
        """
        Update an existing item.
    
        Args:
            item_id: The unique identifier of the item to update
            name: New name (optional)
            description: New description (optional)
            metadata: New metadata (optional, replaces existing)
    
        Returns:
            The updated item data
    
        Raises:
            ValueError: If the item is not found
        """
        # In a real implementation:
        # client = get_client()
        # return client.put(f"items/{item_id}", data={"name": name, "description": description, "metadata": metadata})
    
        if item_id not in MOCK_ITEMS:
            raise ValueError(f"Item not found: {item_id}")
    
        from datetime import datetime, timezone
    
        item = MOCK_ITEMS[item_id].copy()
    
        if name is not None:
            item["name"] = name
        if description is not None:
            item["description"] = description
        if metadata is not None:
            item["metadata"] = metadata
    
        item["updated_at"] = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
    
        MOCK_ITEMS[item_id] = item
        return item
  • Registration of the 'update_item' tool using FastMCP's @mcp.tool() decorator applied to the imported example.update_item function.
    mcp.tool()(example.update_item)
  • Documentation of the 'update_item' tool in the getting_started prompt.
    5. update_item - Update an existing item
  • Mock data store used by update_item (and other functions) to simulate persistent item storage.
    MOCK_ITEMS: dict[str, dict[str, Any]] = {
        "item-1": {
            "id": "item-1",
            "name": "Example Item 1",
            "description": "This is a sample item",
            "created_at": "2024-01-01T00:00:00Z",
            "updated_at": "2024-01-01T00:00:00Z",
        },
        "item-2": {
            "id": "item-2",
            "name": "Example Item 2",
            "description": "Another sample item",
            "created_at": "2024-01-02T00:00:00Z",
            "updated_at": "2024-01-02T00:00:00Z",
        },
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/nickweedon/playwritght-proxy-mcp'

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