Skip to main content
Glama

create_estimate

Create a new estimate for a client. Supports optional line items, custom pricing, taxes, discounts, and purchase order numbers.

Instructions

Create a new estimate for a client with optional line items and terms. Supports custom pricing, taxes, and discounts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYesThe client ID to create the estimate for (required)
subjectNoEstimate subject line
notesNoEstimate notes or description
currencyNo3-letter ISO currency code (e.g., USD, EUR)
issue_dateNoEstimate issue date (YYYY-MM-DD)
taxNoTax percentage (0-100)
tax2NoSecond tax percentage (0-100)
discountNoDiscount percentage (0-100)
purchase_orderNoClient purchase order number

Implementation Reference

  • CreateEstimateHandler: The core handler class that executes the create_estimate tool logic. It validates args using CreateEstimateSchema, calls harvestClient.createEstimate(), and returns the result as MCP content.
    class CreateEstimateHandler implements ToolHandler {
      constructor(private readonly config: BaseToolConfig) {}
    
      async execute(args: Record<string, any>): Promise<CallToolResult> {
        try {
          const validatedArgs = validateInput(CreateEstimateSchema, args, 'create estimate');
          logger.info('Creating estimate via Harvest API');
          const estimate = await this.config.harvestClient.createEstimate(validatedArgs);
          
          return {
            content: [{ type: 'text', text: JSON.stringify(estimate, null, 2) }],
          };
        } catch (error) {
          return handleMCPToolError(error, 'create_estimate');
        }
      }
    }
  • CreateEstimateSchema: Zod schema defining input validation for creating an estimate (client_id required; subject, notes, currency, issue_date, tax, tax2, discount, purchase_order optional).
    export const CreateEstimateSchema = z.object({
      client_id: z.number().int().positive(),
      subject: z.string().optional(),
      notes: z.string().optional(),
      currency: z.string().length(3).optional().default('USD'),
      issue_date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be in YYYY-MM-DD format').optional(),
      tax: z.number().min(0).max(100).optional(),
      tax2: z.number().min(0).max(100).optional(),
      discount: z.number().min(0).max(100).optional(),
      purchase_order: z.string().optional(),
    });
  • Tool registration entry for 'create_estimate' within registerEstimateTools(). Defines tool name, description, inputSchema metadata, and wires it to CreateEstimateHandler.
    {
      tool: {
        name: 'create_estimate',
        description: 'Create a new estimate for a client with optional line items and terms. Supports custom pricing, taxes, and discounts.',
        inputSchema: {
          type: 'object',
          properties: {
            client_id: { type: 'number', description: 'The client ID to create the estimate for (required)' },
            subject: { type: 'string', description: 'Estimate subject line' },
            notes: { type: 'string', description: 'Estimate notes or description' },
            currency: { type: 'string', minLength: 3, maxLength: 3, description: '3-letter ISO currency code (e.g., USD, EUR)' },
            issue_date: { type: 'string', format: 'date', description: 'Estimate issue date (YYYY-MM-DD)' },
            tax: { type: 'number', minimum: 0, maximum: 100, description: 'Tax percentage (0-100)' },
            tax2: { type: 'number', minimum: 0, maximum: 100, description: 'Second tax percentage (0-100)' },
            discount: { type: 'number', minimum: 0, maximum: 100, description: 'Discount percentage (0-100)' },
            purchase_order: { type: 'string', description: 'Client purchase order number' },
          },
          required: ['client_id'],
          additionalProperties: false,
        },
      },
      handler: new CreateEstimateHandler(config),
    },
  • src/server.ts:84-95 (registration)
    Server-level registration: registerEstimateTools(config) is called in registerAllTools() and its results are stored in the tools and toolHandlers maps.
        registerEstimateTools(config),
        registerReportTools(config),
      ];
    
      // Flatten and register all tools
      toolModules.forEach(toolRegistrations => {
        toolRegistrations.forEach(({ tool, handler }) => {
          this.tools.set(tool.name, tool);
          this.toolHandlers.set(tool.name, handler);
        });
      });
    }
  • EstimatesClient.createEstimate(): The API client layer that validates input via CreateEstimateSchema and posts to the Harvest API /estimates endpoint.
    async createEstimate(input: CreateEstimateInput): Promise<any> {
      try {
        const validatedInput = CreateEstimateSchema.parse(input);
        
        this.logger.debug('Creating estimate', {
          clientId: validatedInput.client_id,
          subject: validatedInput.subject
        });
        
        const response: AxiosResponse = await this.client.post('/estimates', validatedInput);
        
        this.logger.info('Successfully created estimate', {
          estimateId: response.data.id,
          estimateNumber: response.data.number
        });
        
        return response.data;
      } catch (error) {
        if (error instanceof z.ZodError) {
          this.logger.error('Create estimate validation failed:', error.errors);
          throw new Error('Invalid estimate input data');
        }
        throw error;
      }
    }
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 does not disclose behavioral traits such as side effects, permissions, or response format. The description is generic.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

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

The description is concise (2 sentences) and front-loaded. However, it includes inaccurate information about line items and terms, which compromises clarity.

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 9 parameters and no annotations or output schema, the description is minimally complete. It covers client, items, pricing, but misses behavioral context and the line items discrepancy reduces completeness.

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?

Schema coverage is 100%, so baseline is 3. However, the description mentions 'optional line items and terms' which are not present in the input schema, creating a misleading expectation. This reduces the score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Create a new estimate for a client' with specific verb and resource, and mentions optional features. It distinguishes from sibling tools like update_estimate, delete_estimate, etc.

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?

Usage guidelines are implied but not explicit. The description says when to use (to create an estimate) but offers no when-not-to-use or alternatives (e.g., create_invoice).

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/ianaleck/harvest-mcp-server'

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