Skip to main content
Glama
yincongcyincong

VictoriaMetrics-mcp-server

vm_labels

Extract all unique label names from VictoriaMetrics data for enhanced metadata analysis and query optimization.

Instructions

Get all unique label names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Implements the core logic for the vm_labels tool by querying the VictoriaMetrics API endpoint /api/v1/labels to retrieve all unique label names and returns the JSON data.
    async function vmLabels() { let urlStr = VM_URL if (urlStr === "") { urlStr = VM_SELECT_URL } const url = new URL(urlStr + "/api/v1/labels"); const response = await fetch(url.toString()); const data = await response.json(); if (data.status === "success") { return { content: [{ type: "text", text: JSON.stringify(data.data), }], isError: false }; } else { return { content: [{ type: "text", text: "range query fail:" + await response.text(), }], isError: true }; } }
  • Defines the tool metadata, description, and input schema (empty object since no input parameters are required).
    const VM_LABELS_TOOL = { name: "vm_labels", description: "Get all unique label names", inputSchema: { type: "object", properties: {}, required: [], } };
  • src/index.js:127-134 (registration)
    Registers VM_LABELS_TOOL in the array of tools returned by the ListToolsRequest 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 ];
  • src/index.js:356-358 (registration)
    Registers the vmLabels handler function in the switch statement for CallToolRequest.
    case "vm_labels": { return await vmLabels(); }

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

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