Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

write_data

Write time-series data to InfluxDB databases using Line Protocol format for GigAPI Timeseries Lake integration.

Instructions

Write data using InfluxDB Line Protocol format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYes
dataYes

Implementation Reference

  • The primary handler function for the MCP 'write_data' tool. It invokes the underlying client.write_data method, handles exceptions, and formats the success/error 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 input schema model matching the write_data handler parameters (database and data).
    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")
  • FastMCP Tool registration for the 'write_data' tool, binding the GigAPITools.write_data method.
    Tool.from_function(
        tools_instance.write_data,
        name="write_data",
        description="Write data using InfluxDB Line Protocol format.",
    ),
  • Supporting client method that performs the actual HTTP POST request to the GigAPI /write endpoint for writing data.
    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()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states 'Write data,' implying a mutation operation, but lacks details on permissions, side effects, error handling, or rate limits. This is inadequate for a tool that modifies data without structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and format, making it appropriately sized and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks behavioral details, parameter explanations, and usage context, failing to compensate for the missing structured data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions 'InfluxDB Line Protocol format' for the 'data' parameter, adding some context, but doesn't explain the 'database' parameter or provide examples. With 2 undocumented parameters, this partial coverage is insufficient.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Write data') and specifies the format ('using InfluxDB Line Protocol format'), which provides a specific verb and technical context. However, it doesn't differentiate from sibling tools like 'run_select_query' or 'list_databases' beyond the write operation, keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives. With siblings like 'run_select_query' for reading data and 'list_databases' for metadata, there's no mention of prerequisites, scenarios, or exclusions, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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