Skip to main content
Glama

infracost_cloud_upload_custom_properties

Upload CSV data to Infracost Cloud for custom resource property classification and cloud governance. Enables cost estimation and management through structured property values.

Instructions

Upload custom property values to Infracost Cloud via CSV for resource classification. Requires INFRACOST_SERVICE_TOKEN environment variable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgSlugNoOrganization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)
csvDataYesCSV data containing custom properties

Implementation Reference

  • Handler method in InfracostTools class that executes the tool: validates args with schema, checks auth/org, calls API client to upload CSV data, returns success/error response.
    async handleUploadCustomProperties(args: z.infer<typeof UploadCustomPropertiesSchema>) {
      if (!this.cloudApiClient) {
        throw new Error('INFRACOST_SERVICE_TOKEN is not configured for Infracost Cloud API operations');
      }
    
      const orgSlug = args.orgSlug || this.config.orgSlug;
      if (!orgSlug) {
        throw new Error('Organization slug is required. Provide it via orgSlug parameter or set INFRACOST_ORG environment variable');
      }
    
      const { csvData } = args;
      const result = await this.cloudApiClient.uploadCustomProperties(orgSlug, { csvData });
    
      if (!result.success) {
        throw new Error(result.error || 'Upload custom properties request failed');
      }
    
      return {
        content: [
          {
            type: 'text',
            text: result.output || 'Custom properties uploaded successfully',
          },
        ],
      };
    }
  • Zod schema defining input for the tool: optional orgSlug and required csvData string.
    export const UploadCustomPropertiesSchema = z.object({
      orgSlug: z.string().optional().describe('Organization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)'),
      csvData: z.string().describe('CSV data containing custom properties'),
    });
  • src/index.ts:676-694 (registration)
    Tool registration in ListToolsRequestHandler: defines name, description, and inputSchema matching the Zod schema.
    {
      name: 'infracost_cloud_upload_custom_properties',
      description:
        'Upload custom property values to Infracost Cloud via CSV for resource classification. Requires INFRACOST_SERVICE_TOKEN environment variable.',
      inputSchema: {
        type: 'object',
        properties: {
          orgSlug: {
            type: 'string',
            description: 'Organization slug from Infracost Cloud (defaults to INFRACOST_ORG env var)',
          },
          csvData: {
            type: 'string',
            description: 'CSV data containing custom properties',
          },
        },
        required: ['csvData'],
      },
    },
  • Core API client method that performs the HTTP POST to upload CSV custom properties to Infracost Cloud API.
    async uploadCustomProperties(
      orgSlug: string,
      request: UploadCustomPropertiesRequest
    ): Promise<CommandResult> {
      try {
        const response = await fetch(
          `${INFRACOST_CLOUD_API_BASE}/orgs/${orgSlug}/custom-properties`,
          {
            method: 'POST',
            headers: {
              'Content-Type': 'text/csv',
              Authorization: `Bearer ${this.serviceToken}`,
            },
            body: request.csvData,
          }
        );
    
        if (!response.ok) {
          const errorText = await response.text();
          return {
            success: false,
            error: `API request failed with status ${response.status}: ${errorText}`,
          };
        }
    
        // Handle 204 No Content response (common for uploads)
        if (response.status === 204) {
          return {
            success: true,
            output: 'Custom properties uploaded successfully',
          };
        }
    
        // Try to parse JSON response if there is content
        const contentType = response.headers.get('content-type');
        if (contentType && contentType.includes('application/json')) {
          const data = await response.json();
          return {
            success: true,
            output: JSON.stringify(data, null, 2),
            data,
          };
        }
    
        // Fallback for non-JSON responses
        return {
          success: true,
          output: 'Custom properties uploaded successfully',
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred',
        };
      }
    }
  • src/index.ts:779-782 (registration)
    Dispatch case in CallToolRequestHandler that routes the tool call to the handler method.
    case 'infracost_cloud_upload_custom_properties': {
      const validatedArgs = UploadCustomPropertiesSchema.parse(args);
      return await tools.handleUploadCustomProperties(validatedArgs);
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the authentication requirement (INFRACOST_SERVICE_TOKEN), which is useful context, but doesn't cover other behavioral aspects such as whether this is a read/write operation (implied as write from 'upload'), potential side effects, rate limits, or error handling. The description adds some value but leaves significant gaps in transparency.

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 highly concise and front-loaded, consisting of two clear sentences that directly state the tool's purpose and a key requirement. There is no wasted verbiage, and every sentence earns its place by providing essential information efficiently.

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?

Given the tool's complexity (a write operation with authentication needs), lack of annotations, and no output schema, the description is moderately complete. It covers the core purpose and authentication, but misses details like behavioral traits, output format, or error scenarios. For a mutation tool with no structured safety hints, this leaves room for improvement in providing a fuller context.

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%, so the schema fully documents both parameters (orgSlug and csvData). The description adds no additional parameter semantics beyond what's in the schema, such as CSV format details or examples. This meets the baseline of 3 for high schema coverage, but doesn't enhance understanding of the parameters.

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 action ('Upload custom property values'), target ('to Infracost Cloud'), format ('via CSV'), and purpose ('for resource classification'), which is specific and informative. However, it doesn't explicitly differentiate this tool from sibling tools like 'infracost_upload' or other cloud-related tools, which would be needed for a perfect score.

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

Usage Guidelines3/5

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

The description provides some usage context by mentioning the required environment variable ('INFRACOST_SERVICE_TOKEN'), which implies when this tool can be used (when authenticated). However, it lacks explicit guidance on when to use this tool versus alternatives like 'infracost_upload' or other cloud tools, and doesn't specify prerequisites beyond the token, leaving usage scenarios somewhat implied rather than clearly defined.

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/phildougherty/infracost_mcp'

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