Skip to main content
Glama
nickweedon

Skeleton MCP Server

by nickweedon

create_item

Add new items to the system by providing a name, optional description, and metadata for structured data management.

Instructions

Create a new item.

Args: name: The name of the item (required) description: Optional description metadata: Optional key-value metadata

Returns: The created item data including the generated ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionNo
metadataNo

Implementation Reference

  • The handler function that implements the create_item tool logic. It generates a unique ID, timestamps the item, stores it in mock data, and returns the created item.
    async def create_item(
        name: str,
        description: str | None = None,
        metadata: dict[str, str] | None = None,
    ) -> dict[str, Any]:
        """
        Create a new item.
    
        Args:
            name: The name of the item (required)
            description: Optional description
            metadata: Optional key-value metadata
    
        Returns:
            The created item data including the generated ID
        """
        # In a real implementation:
        # client = get_client()
        # return client.post("items", data={"name": name, "description": description, "metadata": metadata})
    
        import uuid
        from datetime import datetime, timezone
    
        item_id = f"item-{uuid.uuid4().hex[:8]}"
        now = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
    
        item = {
            "id": item_id,
            "name": name,
            "description": description,
            "metadata": metadata,
            "created_at": now,
            "updated_at": now,
        }
    
        MOCK_ITEMS[item_id] = item
        return item
  • Registration of API tools including create_item using the mcp.tool() decorator from the example module.
    mcp.tool()(example.list_items)
    mcp.tool()(example.get_item)
    mcp.tool()(example.create_item)
    mcp.tool()(example.update_item)
    mcp.tool()(example.delete_item)

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