update_records
Modify multiple records in an Airtable base using secure OAuth 2.0 authentication. Specify base ID, table ID, and record updates to streamline data management tasks efficiently.
Instructions
Update multiple records
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_id | Yes | The Airtable base ID | |
| records | Yes | List of record updates | |
| table_id | Yes | The table ID or name | |
| typecast | No | Enable automatic data conversion |
Implementation Reference
- src/airtable_mcp/mcp/server.py:360-388 (handler)The main handler function for the 'update_records' MCP tool. It gets an authenticated client, calls the client's update_records method, and returns formatted records. The @self.mcp.tool decorator also registers the tool.@self.mcp.tool(description="Update multiple records") async def update_records( base_id: Annotated[str, Field(description="The Airtable base ID")], table_id: Annotated[str, Field(description="The table ID or name")], records: Annotated[ list[dict[str, Any]], Field(description="List of record updates") ], typecast: Annotated[ bool, Field(description="Enable automatic data conversion") ] = False, ) -> list[dict[str, Any]]: """Update multiple records in a table.""" client = await self._get_authenticated_client() updated_records = await client.update_records( base_id, table_id, records, typecast, ) return [ { "id": record.id, "fields": record.fields, "createdTime": record.created_time, } for record in updated_records ]
- Pydantic schema defining the input arguments for the update_records tool.class UpdateRecordsArgs(BaseArgs): """Arguments for update_records tool.""" base_id: str = Field(description="The Airtable base ID") table_id: str = Field(description="The table ID or name") records: list[dict[str, Any]] = Field(description="List of record updates") typecast: bool | None = Field( default=False, description="Enable automatic data conversion" )
- The AirtableClient helper method that performs the actual API PATCH request to update records, using rate limiting and error handling.async def update_records( self, base_id: str, table_id: str, records: list[dict[str, Any]], typecast: bool = False, ) -> list[AirtableRecord]: """Update existing records in a table. Args: base_id: The Airtable base ID table_id: The table ID or name records: List of record updates (each should have 'id' and 'fields' keys) typecast: Whether to enable automatic data conversion Returns: List of updated records """ logger.info(f"Updating {len(records)} records in {base_id}/{table_id}") request_data = UpdateRecordsRequest( records=records, typecast=typecast, ) response = await self._make_request( "PATCH", f"/v0/{base_id}/{table_id}", data=request_data.model_dump(by_alias=True, exclude_none=True), response_model=UpdateRecordsResponse, ) return response.records
- src/airtable_mcp/api/models.py:84-95 (schema)Pydantic models for the request and response of the update records API call, used by the client helper.class UpdateRecordsRequest(BaseModel): """Request for updating records.""" records: list[dict[str, Any]] typecast: bool | None = False class UpdateRecordsResponse(BaseModel): """Response from updating records.""" records: list[AirtableRecord]