Skip to main content
Glama
cortezcristian

Kubecost MCP Server

get_budget

Retrieve detailed information about a specific budget rule in Kubecost to monitor and manage cloud spending effectively.

Instructions

Get detailed information about a specific budget rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budgetIdYes

Implementation Reference

  • src/index.ts:55-72 (registration)
    Registration of the 'get_budget' MCP tool, including description, input schema requiring 'budgetId' as string, and inline handler function that executes kubecostClient.getBudget(budgetId) and returns the JSON-formatted result or error.
    this.tool( 'get_budget', 'Get detailed information about a specific budget rule', { budgetId: z.string() }, async ({ budgetId }) => { try { const result = await this.kubecostClient.getBudget(budgetId); 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 core handler logic for the 'get_budget' tool: extracts budgetId from arguments, calls the Kubecost client to fetch the budget, stringifies the result as JSON text content for MCP response.
    async ({ budgetId }) => { try { const result = await this.kubecostClient.getBudget(budgetId); 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 definition for the 'get_budget' tool using Zod: requires a 'budgetId' string parameter.
    { budgetId: z.string() },
  • Helper method in KubecostClient that implements the actual API call to retrieve budget details via GET /model/budget/{budgetId}, returning BudgetResponse.
    async getBudget(budgetId: string): Promise<BudgetResponse> { const response = await this.client.get(`/model/budget/${budgetId}`); return response.data; }
  • Detailed JSON schema definition for 'get_budget' tool input (appears unused in current registration).
    get_budget: { description: 'Get detailed information about a specific budget rule', inputSchema: { type: 'object', properties: { budgetId: { type: 'string', description: 'The ID of the budget rule to retrieve', }, }, required: ['budgetId'], }, },

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