get_business
Retrieve the complete Yelp profile for a specific business by ID or alias. Access hours, photos, address, price tier, categories, and URL.
Instructions
Fetch the full Yelp profile for a specific business by its ID or alias. Use when you already have a Yelp business ID and need complete details: hours, all photos, full address, price tier, categories, and URL. Raises an error if the business ID does not exist on Yelp.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| business_id | Yes | Yelp business ID or alias, e.g. 'tartine-bakery-san-francisco'. Obtain from search_businesses, find_business_by_phone, or match_business. | |
| locale | No | BCP 47 locale, e.g. 'en_US', 'fr_FR'. Defaults to en_US. |
Implementation Reference
- server/handlers/tools.py:213-226 (handler)The actual handler function for the get_business tool. Validates input (GetBusinessParams), optionally adds locale, calls Yelp API GET /businesses/{id}, validates the response as BusinessDetail, and returns JSON.
async def _get_business( arguments: dict[str, Any], client: YelpClient, ) -> ToolContent: params = GetBusinessParams.model_validate(arguments) query: dict[str, object] = {} if params.locale: query["locale"] = params.locale raw = await client.get( f"businesses/{params.business_id}", params=query or None, ) detail = BusinessDetail.model_validate(raw) return _json(detail.model_dump(exclude_none=True)) - server/handlers/params.py:130-141 (schema)Input schema (Pydantic model) for get_business. Defines required business_id and optional locale fields with descriptions.
class GetBusinessParams(BaseModel): business_id: str = Field( ..., description=( "Yelp business ID or alias, e.g. 'tartine-bakery-san-francisco'. " "Obtain from search_businesses, find_business_by_phone, or match_business." ), ) locale: str | None = Field( default=None, description="BCP 47 locale, e.g. 'en_US', 'fr_FR'. Defaults to en_US.", ) - server/core/models.py:76-94 (schema)Output schema for get_business (and match_business). Defines the full business detail record returned from the Yelp API.
class BusinessDetail(_YelpBase): """Full business record returned by get_business and match_business.""" id: str name: str url: str | None = None phone: str | None = None display_phone: str | None = None rating: float | None = None review_count: int | None = None price: str | None = None is_closed: bool = False location: Location | None = None categories: list[Category] = Field(default_factory=list) coordinates: Coordinates | None = None image_url: str | None = None photos: list[str] = Field(default_factory=list) hours: list[Hours] = Field(default_factory=list) alias: str | None = None - server/handlers/tools.py:108-118 (registration)Tool registration entry listing get_business in the TOOLS catalogue with description, input schema, and idempotent annotation.
_tool( "get_business", ( "Fetch the full Yelp profile for a specific business by its ID or alias. " "Use when you already have a Yelp business ID and need complete details: " "hours, all photos, full address, price tier, categories, and URL. " "Raises an error if the business ID does not exist on Yelp." ), GetBusinessParams, idempotent=True, ), - server/handlers/tools.py:157-158 (registration)Dispatch in call_tool handler that routes get_business calls to _get_business.
if name == "get_business": return await _get_business(arguments, client)