update_record
Modify existing records in enterprise systems like Salesforce or NetSuite by specifying record type, ID, and field updates. This tool handles API integration and authentication for data management tasks.
Instructions
Update an existing record in the upstream API.
Args: record_type: The type of record (e.g., "customer", "invoice") record_id: Internal ID of the record. updates: Dictionary of fields to update. account_id: Account ID (required if not configured on server). base_url: Optional full API URL (overrides account_id).
Returns: Structured response with update result.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| record_type | Yes | ||
| record_id | Yes | ||
| updates | Yes | ||
| account_id | No | ||
| base_url | No |
Implementation Reference
- src/my_mcp_server/server.py:652-680 (handler)The MCP tool handler for 'update_record', which accepts user input and calls the API client.
async def update_record( record_type: str, record_id: str, updates: Dict[str, Any], account_id: Optional[str] = None, base_url: Optional[str] = None, ) -> Dict[str, Any]: """ Update an existing record in the upstream API. Args: record_type: The type of record (e.g., "customer", "invoice") record_id: Internal ID of the record. updates: Dictionary of fields to update. account_id: Account ID (required if not configured on server). base_url: Optional full API URL (overrides account_id). Returns: Structured response with update result. """ token = _get_oauth_token() async with _get_client(base_url, account_id) as client: response = await client.update_record( access_token=token, record_type=record_type, record_id=record_id, payload=updates, base_url_override=base_url, - src/my_mcp_server/api_client.py:408-430 (handler)The actual implementation of the update_record logic that performs the PATCH request to the API.
async def update_record( self, access_token: str, record_type: str, record_id: str, payload: Dict[str, Any], base_url_override: Optional[str] = None, ) -> APIResponse: """ Update an existing record (partial update via PATCH). Args: access_token: OAuth Bearer token record_type: The record type/endpoint name record_id: The record's internal ID payload: Fields to update base_url_override: Override the base URL """ base = base_url_override or self._base_url url = f"{base}/{record_type}/{record_id}" logger.info(f"Updating {record_type} #{record_id}") return await self._request_with_retry("PATCH", url, access_token, json_body=payload)