write_line_protocol
Write single records or batches to InfluxDB in line protocol format, specifying database and timestamp precision for accurate time-series ingestion.
Instructions
Write data to InfluxDB using line protocol format (all versions). Supports single records or batches.
Line Protocol Syntax: measurement,tag1=value1,tag2=value2 field1=value1,field2=value2 timestamp
Components:
measurement: table/measurement name (required)
tags: indexed metadata (optional) - comma-separated key=value pairs
fields: actual data (required) - space-separated from tags, comma-separated key=value pairs
timestamp: optional timestamp (precision must be specified in tool parameters)
Field Value Types:
Strings: "quoted string"
Floats: 123.45
Integers: 123i (note the 'i' suffix)
Booleans: t or f
Examples: Single record: temperature,location=office,building=main value=23.5,humidity=45i 1640995200 Batch (separate with newlines): temperature,location=office value=23.5 1640995200 humidity,location=office value=45i 1640995201
Important: Always specify correct precision parameter to match your timestamp format. Use any precision if writing data with no timestamp. Escaping required for special characters in tags/fields.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"database": "<database>",
"data": "<data>",
"precision": "<precision>"
},
"name": "write_line_protocol"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Line protocol formatted data. For multiple records, separate each line with \n | |
| noSync | No | Acknowledge without waiting for WAL persistence | |
| database | Yes | Name of the database to write to | |
| precision | Yes | Precision of timestamps | |
| acceptPartial | No | Accept partial writes |