Skip to main content
Glama
idoru

InfluxDB MCP Server

by idoru

create-org

Create organizations to isolate users or projects, enabling bucket and token generation.

Instructions

Create a brand-new organization to isolate users or projects before generating buckets and tokens.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDisplay name for the organization as it should appear in InfluxDB Cloud/OSS.
descriptionNoOptional free-form description that helps humans understand why the org exists.

Implementation Reference

  • The main handler function 'createOrg' that executes the create-org tool logic. It takes name and description, sends a POST to InfluxDB /api/v2/orgs, and returns the created organization details.
    import { influxRequest } from "../utils/influxClient.js";
    
    // Tool: Create Organization
    export async function createOrg({ name, description }) {
      try {
        const orgData = {
          name,
          description,
        };
    
        const response = await influxRequest("/api/v2/orgs", {
          method: "POST",
          body: JSON.stringify(orgData),
        });
    
        const org = await response.json();
    
        return {
          content: [{
            type: "text",
            text:
              `Organization created successfully:\nID: ${org.id}\nName: ${org.name}\nDescription: ${org.description || "N/A"
              }`,
          }],
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error creating organization: ${error.message}`,
          }],
          isError: true,
        };
      }
    }
  • Schema definition for the 'create-org' tool: accepts a required 'name' string and an optional 'description' string, defined using Zod.
    server.tool(
      "create-org",
      "Create a brand-new organization to isolate users or projects before generating buckets and tokens.",
      {
        name: z
          .string()
          .describe(
            "Display name for the organization as it should appear in InfluxDB Cloud/OSS.",
          ),
        description: z
          .string()
          .optional()
          .describe(
            "Optional free-form description that helps humans understand why the org exists.",
          ),
      },
      createOrg,
    );
  • src/index.js:143-160 (registration)
    Registration of the 'create-org' tool with the MCP server using server.tool(), binding the schema and handler together.
    server.tool(
      "create-org",
      "Create a brand-new organization to isolate users or projects before generating buckets and tokens.",
      {
        name: z
          .string()
          .describe(
            "Display name for the organization as it should appear in InfluxDB Cloud/OSS.",
          ),
        description: z
          .string()
          .optional()
          .describe(
            "Optional free-form description that helps humans understand why the org exists.",
          ),
      },
      createOrg,
    );
  • The 'influxRequest' helper utility used by the handler to make authenticated HTTP requests to the InfluxDB API with timeout and error handling.
    import fetch from "node-fetch";
    import { INFLUXDB_TOKEN, INFLUXDB_URL } from "../config/env.js";
    
    // Helper function for InfluxDB API requests with timeout
    export async function influxRequest(endpoint, options = {}, timeoutMs = 5000) {
      const url = `${INFLUXDB_URL}${endpoint}`;
      const defaultOptions = {
        headers: {
          Authorization: `Token ${INFLUXDB_TOKEN}`,
          "Content-Type": "application/json",
        },
      };
    
      console.log(`Making request to: ${url}`);
    
      try {
        // Use AbortController for proper request cancellation
        const controller = new AbortController();
        const timeoutId = setTimeout(() => {
          controller.abort(`InfluxDB API request timed out after ${timeoutMs}ms`);
        }, timeoutMs);
    
        // Properly merge headers to avoid conflicts
        // This ensures custom headers (like Content-Type) aren't overridden
        const mergedHeaders = {
          ...defaultOptions.headers,
          ...options.headers || {},
        };
    
        // Add the abort signal to the request options
        const requestOptions = {
          ...defaultOptions,
          ...options,
          headers: mergedHeaders,
          signal: controller.signal,
        };
    
        console.log(`Request options: ${JSON.stringify({
          method: requestOptions.method,
          headers: Object.keys(requestOptions.headers),
        })
          }`);
    
        // Make the request
        const response = await fetch(url, requestOptions);
    
        // Clear the timeout since the request completed
        clearTimeout(timeoutId);
    
        console.log(`Response status: ${response.status}`);
    
        if (!response.ok) {
          const errorText = await Promise.race([
            response.text(),
            new Promise((_, reject) =>
              setTimeout(() => reject(new Error("Response text timeout")), 3000)
            ),
          ]);
          throw new Error(`InfluxDB API Error (${response.status}): ${errorText}`);
        }
    
        return response;
      } catch (error) {
        // Log the error with more details
        console.error(`Error in influxRequest to ${url}:`, error.message);
        // Rethrow to be handled by the caller
        throw error;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden. It only states the creation action but does not disclose any side effects, required permissions, or behavioral constraints, leaving significant gaps for a mutation tool.

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, well-structured sentence that front-loads the action and purpose. No extraneous words; every part earns its place.

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

Completeness3/5

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

For a simple creation tool with two parameters and no output schema, the description provides the essential purpose but lacks details on return values or post-creation behavior, making it adequate but not fully complete.

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% (both name and description are documented in the schema). The tool description adds no extra meaning beyond what the schema already provides, so baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the action (create), the resource (organization), and the purpose (isolate users/projects as a prerequisite for buckets/tokens). It distinguishes from siblings like create-bucket and query-data.

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

Usage Guidelines4/5

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

The phrase 'before generating buckets and tokens' effectively indicates when to use this tool as a prerequisite step. While it lacks explicit exclusions or comparisons, the context is sufficient for an AI agent.

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/idoru/influxdb-mcp-server'

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