delete_item
Remove an item from the Skeleton MCP Server by specifying its unique identifier. This tool deletes items and returns confirmation when successful.
Instructions
Delete an item.
Args: item_id: The unique identifier of the item to delete
Returns: A confirmation message
Raises: ValueError: If the item is not found
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"item_id": {
"type": "string"
}
},
"required": [
"item_id"
],
"type": "object"
}
Implementation Reference
- src/skeleton_mcp/api/example.py:188-210 (handler)The main handler function for the 'delete_item' tool. It takes an item_id parameter, checks if the item exists in the mock store, deletes it if found, and returns a confirmation dictionary. Includes comprehensive docstring defining input/output and error handling.async def delete_item(item_id: str) -> dict[str, Any]: """ Delete an item. Args: item_id: The unique identifier of the item to delete Returns: A confirmation message Raises: ValueError: If the item is not found """ # In a real implementation: # client = get_client() # return client.delete(f"items/{item_id}") if item_id not in MOCK_ITEMS: raise ValueError(f"Item not found: {item_id}") del MOCK_ITEMS[item_id] return {"status": "deleted", "id": item_id}
- src/skeleton_mcp/server.py:93-93 (registration)Registers the delete_item function from the example module as an MCP tool using the FastMCP tool decorator.mcp.tool()(example.delete_item)
- src/skeleton_mcp/server.py:88-94 (registration)The block of registrations for all example API tools, including delete_item.# Example: Import and register tools from your custom modules 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)