Skip to main content
Glama
yincongcyincong

VictoriaMetrics-mcp-server

vm_data_write

Write time-series data to VictoriaMetrics database by specifying metrics, values, and timestamps for storage and analysis.

Instructions

Write data to the VM database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricYestag of metric
valuesYesArray of metric values
timestampsYesArray of metric timestamps

Implementation Reference

  • Core handler function that performs the HTTP POST request to VictoriaMetrics /api/v1/import endpoint with the provided metric, values, and timestamps, returning success or error content.
    async function vmMetricsDataWrite(metric, values, timestamps) {
      let urlStr = VM_URL
      if (urlStr === "") {
        urlStr = VM_INSERT_URL
      }
      const url = new URL(urlStr + "/api/v1/import");
      const data = {
        "metric": metric,
        "values": values,
        "timestamps": timestamps
      };
    
      const response = await fetch(url.toString(), {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(data)
      });
      const status = response.status;
    
      if (status === 204) {
        return {
          content: [{
            type: "text",
            text: response.text(),
          }],
          isError: false
        };
      } else {
        return {
          content: [{
            type: "text",
            text: response.text(),
          }],
          isError: true
        };
      }
    }
  • Defines the tool schema including name, description, and input schema with required properties: metric (object), values (array of numbers), timestamps (array of numbers).
    const VM_DATA_WRITE_TOOL = {
      name: "vm_data_write",
      description: "Write data to the VM database",
      inputSchema: {
        type: "object",
        properties: {
          metric: {
            type: "object",
            description: "tag of metric",
          },
          values: {
            type: "array",
            description: "Array of metric values",
            items: {
              "type": "number"
            },
          },
          timestamps: {
            type: "array",
            description: "Array of metric timestamps",
            items: {
              "type": "number"
            },
          }
        },
        required: ["metric", "values", "timestamps"],
      }
    };
  • src/index.js:127-134 (registration)
    Registers the vm_data_write tool (as VM_DATA_WRITE_TOOL) in the VM_TOOLS array, which is returned by the ListToolsRequestSchema handler.
    const VM_TOOLS = [
      VM_DATA_WRITE_TOOL,
      VM_QUERY_RANGE_TOOL,
      VM_QUERY_TOOL,
      VM_LABELS_TOOL,
      VM_LABEL_VALUES_TOOL,
      VM_PROMETHEUS_WRITE_TOOL
    ];
  • Switch case in CallToolRequestSchema handler that destructures arguments and invokes the vmMetricsDataWrite handler function.
    case "vm_data_write": {
      const {metric, values, timestamps} = request.params.arguments;
      return await vmMetricsDataWrite(metric, values, timestamps);
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Write data' implying a mutation operation, but doesn't disclose behavioral traits like required permissions, whether writes are idempotent, rate limits, or error handling. This leaves significant gaps for a write tool with no 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 and appropriately sized for a simple tool name, though it could be more informative given the lack of annotations.

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?

Given the complexity (a write operation with 3 required parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't cover return values, error cases, or behavioral context, leaving the agent under-informed for safe and effective use.

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

Parameters3/5

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

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no meaning beyond the schema—it doesn't explain relationships between metric, values, and timestamps, or provide examples. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Write data to the VM database' clearly states the action (write) and target (VM database), but it's vague about what type of data is written. It distinguishes from sibling tools like vm_query (read operations) but doesn't specify that it writes metric data specifically, which the schema reveals.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, when-not scenarios, or compare to siblings like vm_prometheus_write (which might be for different data formats or protocols). The agent must infer usage from the name and schema alone.

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/yincongcyincong/VictoriaMetrics-mcp-server'

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