Skip to main content
Glama
OilpriceAPI

OilPriceAPI

Official
by OilpriceAPI

opa_get_storage

Retrieve current oil storage and inventory levels for Cushing, Oklahoma (WTI delivery hub) and the US Strategic Petroleum Reserve (SPR), with changes indicated.

Instructions

Get oil storage and inventory levels for Cushing, Oklahoma (WTI delivery hub) and/or the US Strategic Petroleum Reserve (SPR). Use when the user asks about oil inventories, storage levels, Cushing stocks, or the SPR. Returns current inventory levels with changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
facilityNoStorage facility: cushing (WTI delivery hub), spr (Strategic Petroleum Reserve), or all (default: all)all

Implementation Reference

  • src/index.ts:1190-1241 (registration)
    Registration of the 'opa_get_storage' tool via server.tool(), defining its name, description, input schema (facility enum), and handler callback.
    server.tool(
      "opa_get_storage",
      "Get oil storage and inventory levels for Cushing, Oklahoma (WTI delivery hub) and/or the US Strategic Petroleum Reserve (SPR). Use when the user asks about oil inventories, storage levels, Cushing stocks, or the SPR. Returns current inventory levels with changes.",
      {
        facility: z
          .enum(["cushing", "spr", "all"])
          .default("all")
          .describe(
            "Storage facility: cushing (WTI delivery hub), spr (Strategic Petroleum Reserve), or all (default: all)",
          ),
      },
      async ({ facility }) => {
        const sections: string[] = ["# Oil Storage Levels\n"];
        let hasData = false;
    
        if (facility === "cushing" || facility === "all") {
          const response = await makeApiRequest<
            ApiResponse<Record<string, unknown>>
          >("/v1/storage/cushing");
          if (response?.status === "success") {
            hasData = true;
            sections.push("## Cushing, Oklahoma (WTI Hub)\n");
            sections.push(
              "```json\n" + JSON.stringify(response.data, null, 2) + "\n```\n",
            );
          }
        }
    
        if (facility === "spr" || facility === "all") {
          const response =
            await makeApiRequest<ApiResponse<Record<string, unknown>>>(
              "/v1/storage/spr",
            );
          if (response?.status === "success") {
            hasData = true;
            sections.push("## Strategic Petroleum Reserve (SPR)\n");
            sections.push(
              "```json\n" + JSON.stringify(response.data, null, 2) + "\n```\n",
            );
          }
        }
    
        if (!hasData) {
          return errorResult(
            "Storage data not available. This requires a paid plan with energy intelligence access.",
          );
        }
    
        sections.push("_Data from [OilPriceAPI](https://oilpriceapi.com)_");
        return textResult(sections.join("\n"));
      },
    );
  • The handler function for opa_get_storage. It queries Cushing (WTI hub) and/or SPR storage endpoints via makeApiRequest and formats results as text.
      async ({ facility }) => {
        const sections: string[] = ["# Oil Storage Levels\n"];
        let hasData = false;
    
        if (facility === "cushing" || facility === "all") {
          const response = await makeApiRequest<
            ApiResponse<Record<string, unknown>>
          >("/v1/storage/cushing");
          if (response?.status === "success") {
            hasData = true;
            sections.push("## Cushing, Oklahoma (WTI Hub)\n");
            sections.push(
              "```json\n" + JSON.stringify(response.data, null, 2) + "\n```\n",
            );
          }
        }
    
        if (facility === "spr" || facility === "all") {
          const response =
            await makeApiRequest<ApiResponse<Record<string, unknown>>>(
              "/v1/storage/spr",
            );
          if (response?.status === "success") {
            hasData = true;
            sections.push("## Strategic Petroleum Reserve (SPR)\n");
            sections.push(
              "```json\n" + JSON.stringify(response.data, null, 2) + "\n```\n",
            );
          }
        }
    
        if (!hasData) {
          return errorResult(
            "Storage data not available. This requires a paid plan with energy intelligence access.",
          );
        }
    
        sections.push("_Data from [OilPriceAPI](https://oilpriceapi.com)_");
        return textResult(sections.join("\n"));
      },
    );
  • Input schema for opa_get_storage: a 'facility' enum parameter ('cushing', 'spr', 'all') defaulting to 'all', validated with Zod.
    {
      facility: z
        .enum(["cushing", "spr", "all"])
        .default("all")
        .describe(
          "Storage facility: cushing (WTI delivery hub), spr (Strategic Petroleum Reserve), or all (default: all)",
        ),
    },
  • Helper function textResult() used by the handler to format success responses.
    function textResult(text: string) {
      return {
        content: [{ type: "text" as const, text }],
      };
    }
  • Helper function errorResult() used by the handler to format error responses.
    function errorResult(message: string) {
      return {
        content: [{ type: "text" as const, text: message }],
        isError: true,
      };
    }
Behavior3/5

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

No annotations are provided, so the description must cover behavioral traits. It states the return includes 'current inventory levels with changes,' which is helpful, but lacks details like data source, update frequency, or authentication needs. Adequate but not comprehensive.

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?

Two sentences, each serving a clear purpose: first states the function, second gives usage criteria and return info. No unnecessary words, well-structured.

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

Completeness4/5

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

With only one parameter and no output schema, the description covers purpose, usage, and return format. It could mention units or typical values for completeness, but overall it's sufficient for a simple tool.

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

Parameters4/5

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

The schema covers the parameter fully, but the description adds value by explaining the facilities (Cushing as WTI hub, SPR as Strategic Petroleum Reserve) and indicating the return format. This enhances understanding beyond the schema.

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 explicitly states the tool retrieves oil storage and inventory levels for Cushing and/or SPR, and lists example user queries. This clearly distinguishes it from sibling tools like price or drilling data tools.

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 description provides explicit guidance ('Use when the user asks about oil inventories, storage levels, Cushing stocks, or the SPR'), making it easy to decide when to invoke. It does not mention when not to use, but the context is sufficient.

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

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