Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

write_data

Enables writing timeseries data to a specified database using InfluxDB Line Protocol format, supporting seamless integration with GigAPI Timeseries Lake for efficient data management.

Instructions

Write data using InfluxDB Line Protocol format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
databaseYes

Implementation Reference

  • Registration of the 'write_data' MCP tool using FastMCP's Tool.from_function, binding to GigAPITools.write_data method.
    Tool.from_function( tools_instance.write_data, name="write_data", description="Write data using InfluxDB Line Protocol format.", ),
  • Handler function for the 'write_data' tool in GigAPITools class, which delegates to the client and wraps the response.
    def write_data(self, database: str, data: str) -> Dict[str, Any]: """Write data using InfluxDB Line Protocol. Args: database: The database to write to data: Data in InfluxDB Line Protocol format Returns: Write operation result """ try: result = self.client.write_data(database, data) return { "result": result, "success": True, "database": database, "data_lines": len(data.strip().split('\n')) } except GigAPIClientError as e: logger.error(f"Failed to write data: {e}") return { "error": str(e), "success": False, "database": database }
  • Pydantic schema/model for 'write_data' tool input validation (database and data fields).
    class WriteDataInput(BaseModel): """Input model for data writing operations.""" database: str = Field(..., description="The database to write to") data: str = Field(..., description="Data in InfluxDB Line Protocol format")
  • Core implementation in GigAPIClient that performs the HTTP POST to /write endpoint for data ingestion.
    def write_data(self, database: str, data: str) -> Dict[str, Any]: """Write data using InfluxDB Line Protocol. Args: database: Database name data: Data in InfluxDB Line Protocol format Returns: Write response """ params = {"db": database} headers = {"Content-Type": "text/plain"} response = self._make_request( "POST", "/write", data=data, params=params, headers=headers ) return response.json()

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gigapi/gigapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server