get_record
Retrieve specific records from enterprise systems by ID, supporting customers, invoices, and other data types with optional related information.
Instructions
Fetch a record from the upstream API by ID.
Args: record_type: The type of record (e.g., "customer", "invoice") record_id: Internal ID of the record. account_id: Account ID (required if not configured on server). base_url: Optional full API URL (overrides account_id). expand_sub_resources: Include full sublist/related data.
Returns: Structured response with record data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| record_type | Yes | ||
| record_id | Yes | ||
| account_id | No | ||
| base_url | No | ||
| expand_sub_resources | No |
Implementation Reference
- src/my_mcp_server/server.py:618-649 (handler)The get_record tool handler registered with @mcp.tool() in src/my_mcp_server/server.py. It retrieves the OAuth token, uses a configured API client to fetch the record, and serializes the response.
async def get_record( record_type: str, record_id: str, account_id: Optional[str] = None, base_url: Optional[str] = None, expand_sub_resources: bool = False, ) -> Dict[str, Any]: """ Fetch a record from the upstream API by ID. Args: record_type: The type of record (e.g., "customer", "invoice") record_id: Internal ID of the record. account_id: Account ID (required if not configured on server). base_url: Optional full API URL (overrides account_id). expand_sub_resources: Include full sublist/related data. Returns: Structured response with record data. """ token = _get_oauth_token() async with _get_client(base_url, account_id) as client: response = await client.get_record( access_token=token, record_type=record_type, record_id=record_id, base_url_override=base_url, expand_sub_resources=expand_sub_resources, ) return _serialize_response(response)