Skip to main content
Glama
cortezcristian

Kubecost MCP Server

get_cost_allocation

Retrieve detailed cost allocation data from Kubecost to analyze and distribute cloud infrastructure expenses across teams, projects, or resources based on time windows and filtering criteria.

Instructions

Get cost allocation data from Kubecost

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accumulateNo
aggregateNo
filtersNo
windowYes

Implementation Reference

  • src/index.ts:174-197 (registration)
    Registers the MCP tool 'get_cost_allocation' including input schema, description, and the handler function that invokes the Kubecost client.
    this.tool(
      'get_cost_allocation',
      'Get cost allocation data from Kubecost',
      {
        window: z.string(),
        aggregate: z.string().optional(),
        accumulate: z.boolean().optional(),
        filters: z.record(z.string()).optional(),
      },
      async (params) => {
        try {
          const result = await this.kubecostClient.getCostAllocation(params);
          return {
            isError: false,
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
          };
        } catch (error) {
          return {
            isError: true,
            content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }]
          };
        }
      }
    );
  • The handler function for the 'get_cost_allocation' tool that calls the Kubecost client and formats the response.
    async (params) => {
      try {
        const result = await this.kubecostClient.getCostAllocation(params);
        return {
          isError: false,
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
        };
      } catch (error) {
        return {
          isError: true,
          content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }]
        };
      }
    }
  • Input schema for the 'get_cost_allocation' tool defined using Zod for validation.
    {
      window: z.string(),
      aggregate: z.string().optional(),
      accumulate: z.boolean().optional(),
      filters: z.record(z.string()).optional(),
    },
  • Core helper method in KubecostClient that performs the actual API call to retrieve cost allocation data from the Kubecost server.
    async getCostAllocation(params: {
      window: string;
      aggregate?: string;
      accumulate?: boolean;
      filters?: Record<string, string>;
    }): Promise<CostAllocationResponse> {
      const response = await this.client.get('/model/allocation', { params });
      return response.data;
    }
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 of behavioral disclosure. It only states what the tool does ('Get cost allocation data') without mentioning any behavioral traits such as whether it's read-only, requires authentication, has rate limits, or what the output format might be. This is a significant gap for a tool with parameters and no output schema.

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 that directly states the tool's purpose without any unnecessary words. It is appropriately sized and front-loaded, making it easy to parse quickly, though it could benefit from additional context.

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 (4 parameters, no schema descriptions, no output schema, and no annotations), the description is incomplete. It only covers the basic purpose, leaving gaps in usage guidelines, parameter semantics, and behavioral transparency. For a data retrieval tool with multiple parameters, more context is needed to be fully helpful.

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?

The schema description coverage is 0%, meaning none of the 4 parameters (accumulate, aggregate, filters, window) are documented in the schema. The description adds no meaning beyond the tool's purpose, failing to explain what these parameters do, their expected values, or how they affect the cost allocation data retrieval. This leaves the parameters largely unexplained.

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 verb 'Get' and the resource 'cost allocation data from Kubecost', making the purpose specific and understandable. However, it doesn't differentiate this tool from sibling tools like 'get_assets' or 'get_budget', which also retrieve data but for different resources, leaving room for improvement in distinguishing its unique scope.

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 provides no guidance on when to use this tool versus alternatives. There are sibling tools like 'get_assets' and 'get_budget' that might retrieve related data, but the description doesn't mention any context, prerequisites, or exclusions for usage, leaving the agent without clear direction.

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/cortezcristian/kubecost-mcp'

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