Skip to main content
Glama
cortezcristian

Kubecost MCP Server

update_budget

Modify an existing budget rule in Kubecost to adjust spending limits, notification settings, and resource allocations for cost management.

Instructions

Update an existing budget rule in Kubecost

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsYes
budgetIdYes
intervalYes
intervalDayYes
kindYes
nameYes
spendLimitYes
valuesYes

Implementation Reference

  • src/index.ts:112-151 (registration)
    Registration of the 'update_budget' tool on the MCP server, including inline schema and handler function.
    this.tool( 'update_budget', 'Update an existing budget rule in Kubecost', { budgetId: z.string(), name: z.string(), values: z.object({ cluster: z.array(z.string()).optional(), namespace: z.array(z.string()).optional(), label: z.record(z.array(z.string())).optional(), }), kind: z.enum(['soft', 'hard']), interval: z.enum(['weekly', 'monthly']), intervalDay: z.number(), spendLimit: z.number(), actions: z.array(z.object({ percentage: z.number(), emails: z.array(z.string()).optional(), slackWebhooks: z.array(z.string()).optional(), msTeamsWebhooks: z.array(z.string()).optional(), })), }, async ({ budgetId, ...budgetData }) => { try { const result = await this.kubecostClient.createOrUpdateBudget({ ...budgetData, id: budgetId, }); return { isError: false, content: [{ type: 'text', text: `Budget updated successfully: ${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }] }; } } );
  • Handler function for 'update_budget' tool that constructs the budget object with ID and calls KubecostClient.createOrUpdateBudget.
    async ({ budgetId, ...budgetData }) => { try { const result = await this.kubecostClient.createOrUpdateBudget({ ...budgetData, id: budgetId, }); return { isError: false, content: [{ type: 'text', text: `Budget updated successfully: ${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }] }; } }
  • Zod input schema for validating parameters of the 'update_budget' tool.
    budgetId: z.string(), name: z.string(), values: z.object({ cluster: z.array(z.string()).optional(), namespace: z.array(z.string()).optional(), label: z.record(z.array(z.string())).optional(), }), kind: z.enum(['soft', 'hard']), interval: z.enum(['weekly', 'monthly']), intervalDay: z.number(), spendLimit: z.number(), actions: z.array(z.object({ percentage: z.number(), emails: z.array(z.string()).optional(), slackWebhooks: z.array(z.string()).optional(), msTeamsWebhooks: z.array(z.string()).optional(), })), },
  • KubecostClient method that performs the HTTP POST to create or update a budget rule, called by the tool handler.
    async createOrUpdateBudget(budget: BudgetRule): Promise<BudgetResponse> { const response = await this.client.post('/model/budget', budget); return response.data; }

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