Skip to main content
Glama

infracost_upload

Upload cost estimation data from Infracost CLI to Infracost Cloud for centralized tracking and reporting of infrastructure expenses.

Instructions

Upload Infracost JSON output to Infracost Cloud for centralized cost tracking and reporting. Requires infracost CLI to be installed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to Infracost JSON file to upload

Implementation Reference

  • Main handler for infracost_upload tool: checks CLI installation, executes upload via helper, returns MCP response.
    async handleUpload(args: z.infer<typeof UploadSchema>) {
      const isInstalled = await checkInfracostInstalled();
      if (!isInstalled) {
        throw new Error(
          'Infracost CLI is not installed. Please install it from https://www.infracost.io/docs/'
        );
      }
    
      const result = await executeUpload(args);
    
      if (!result.success) {
        throw new Error(result.error || 'Upload command failed');
      }
    
      return {
        content: [
          {
            type: 'text',
            text: result.output || 'Upload completed successfully',
          },
        ],
      };
    }
  • Executes the core logic: runs `infracost upload --path <path>` CLI command and captures output/error.
    export async function executeUpload(options: UploadOptions): Promise<CommandResult> {
      try {
        const args = ['upload', '--path', resolve(options.path)];
    
        const { stdout, stderr } = await execFileAsync('infracost', args, {
          maxBuffer: 10 * 1024 * 1024,
        });
    
        return {
          success: true,
          output: stdout,
          error: stderr || undefined,
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred',
        };
      }
    }
  • Zod schema defining input: path to Infracost JSON file.
    export const UploadSchema = z.object({
      path: z.string().describe('Path to Infracost JSON file'),
    });
  • src/index.ts:719-722 (registration)
    Dispatch in CallToolRequest handler: parses args and calls tools.handleUpload.
    case 'infracost_upload': {
      const validatedArgs = UploadSchema.parse(args);
      return await tools.handleUpload(validatedArgs);
    }
  • src/index.ts:176-190 (registration)
    Tool specification returned by ListTools: name, description, input schema.
    {
      name: 'infracost_upload',
      description:
        'Upload Infracost JSON output to Infracost Cloud for centralized cost tracking and reporting. Requires infracost CLI to be installed.',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to Infracost JSON file to upload',
          },
        },
        required: ['path'],
      },
    },
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. It mentions the prerequisite ('infracost CLI to be installed') and the action ('upload'), but lacks details on behavioral traits such as authentication requirements, rate limits, error handling, or what happens post-upload (e.g., data processing time). For a cloud upload tool with no annotations, this is a significant gap 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core purpose and followed by a prerequisite. It's appropriately sized with minimal waste, though it could be slightly more structured by separating usage context from requirements.

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 no annotations, no output schema, and a simple input schema, the description provides basic purpose and a prerequisite. However, for a cloud upload tool, it lacks details on authentication, response format, or error scenarios, making it incomplete for full contextual understanding. It's adequate but has clear gaps in behavioral 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%, with the single parameter 'path' documented in the schema as 'Path to Infracost JSON file to upload'. The description doesn't add any further meaning beyond this, such as file format specifics or constraints. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't detract either.

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') and resource ('Infracost JSON output to Infracost Cloud'), with the purpose of 'centralized cost tracking and reporting'. It distinguishes from siblings like 'infracost_breakdown' or 'infracost_output' by focusing on cloud upload rather than local analysis or output generation. However, it doesn't explicitly contrast with 'infracost_cloud_upload_custom_properties', which might handle different data types.

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 implies usage when you have Infracost JSON output and want to send it to the cloud service, with the prerequisite that 'infracost CLI to be installed'. It doesn't explicitly state when NOT to use it (e.g., vs. other upload tools) or name alternatives, leaving some ambiguity about the specific context among sibling tools.

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