get_item
Retrieve specific item data using its unique identifier. This tool fetches item information when you provide the item ID, returning the data if the item exists.
Instructions
Get a specific item by ID.
Args: item_id: The unique identifier of the item
Returns: The item data if found
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:81-102 (handler)The main handler function for the 'get_item' tool, which retrieves a specific item by ID from mock data, raising ValueError if not found.async def get_item(item_id: str) -> dict[str, Any]: """ Get a specific item by ID. Args: item_id: The unique identifier of the item Returns: The item data if found Raises: ValueError: If the item is not found """ # In a real implementation: # client = get_client() # return client.get(f"items/{item_id}") if item_id not in MOCK_ITEMS: raise ValueError(f"Item not found: {item_id}") return MOCK_ITEMS[item_id]
- src/skeleton_mcp/server.py:90-90 (registration)Registration of the 'get_item' tool using the FastMCP decorator mcp.tool() on the imported example.get_item function.mcp.tool()(example.get_item)