Skip to main content
Glama
Frihet-io

Frihet MCP Server

Create Expense

create_expense

Record business expenses for tracking costs, deductible items, and vendor payments. Requires description and amount in EUR.

Instructions

Record a new expense. Requires a description and amount. Useful for tracking business costs, deductible expenses, and vendor payments. / Registra un nuevo gasto. Requiere descripcion e importe. Util para seguimiento de costes, gastos deducibles y pagos a proveedores.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesExpense description / Descripcion del gasto
amountYesAmount in EUR / Importe en EUR
categoryNoExpense category (e.g. 'office', 'travel', 'software') / Categoria
dateNoExpense date in ISO 8601 (YYYY-MM-DD) / Fecha del gasto
vendorNoVendor/supplier name / Nombre del proveedor
taxDeductibleNoWhether the expense is tax deductible / Si el gasto es deducible fiscalmente

Implementation Reference

  • The async handler function that executes the create_expense tool logic. It receives validated input, calls the client's createExpense method to make the API request, and returns the formatted response or handles errors.
    async (input) => {
      try {
        const result = await client.createExpense(input);
        return {
          content: [{ type: "text", text: formatRecord("Expense created", result) }],
        };
      } catch (error) {
        return handleToolError(error);
      }
    },
  • Input schema definition for create_expense using Zod. Defines required fields (description, amount) and optional fields (category, date, vendor, taxDeductible) with validation rules and bilingual descriptions.
    inputSchema: {
      description: z.string().describe("Expense description / Descripcion del gasto"),
      amount: z.number().describe("Amount in EUR / Importe en EUR"),
      category: z
        .string()
        .optional()
        .describe("Expense category (e.g. 'office', 'travel', 'software') / Categoria"),
      date: z
        .string()
        .optional()
        .describe("Expense date in ISO 8601 (YYYY-MM-DD) / Fecha del gasto"),
      vendor: z.string().optional().describe("Vendor/supplier name / Nombre del proveedor"),
      taxDeductible: z
        .boolean()
        .optional()
        .describe("Whether the expense is tax deductible / Si el gasto es deducible fiscalmente"),
    },
  • Complete tool registration for create_expense with the MCP server. Includes tool name, title, description, annotations (CREATE_ANNOTATIONS), input schema, and the handler function.
    server.registerTool(
      "create_expense",
      {
        title: "Create Expense",
        description:
          "Record a new expense. Requires a description and amount. " +
          "Useful for tracking business costs, deductible expenses, and vendor payments. " +
          "/ Registra un nuevo gasto. Requiere descripcion e importe. " +
          "Util para seguimiento de costes, gastos deducibles y pagos a proveedores.",
        annotations: CREATE_ANNOTATIONS,
        inputSchema: {
          description: z.string().describe("Expense description / Descripcion del gasto"),
          amount: z.number().describe("Amount in EUR / Importe en EUR"),
          category: z
            .string()
            .optional()
            .describe("Expense category (e.g. 'office', 'travel', 'software') / Categoria"),
          date: z
            .string()
            .optional()
            .describe("Expense date in ISO 8601 (YYYY-MM-DD) / Fecha del gasto"),
          vendor: z.string().optional().describe("Vendor/supplier name / Nombre del proveedor"),
          taxDeductible: z
            .boolean()
            .optional()
            .describe("Whether the expense is tax deductible / Si el gasto es deducible fiscalmente"),
        },
      },
      async (input) => {
        try {
          const result = await client.createExpense(input);
          return {
            content: [{ type: "text", text: formatRecord("Expense created", result) }],
          };
        } catch (error) {
          return handleToolError(error);
        }
      },
    );
  • The FrihetClient method that performs the actual HTTP POST request to /expenses endpoint to create an expense in the Frihet ERP API.
    async createExpense(data: Record<string, unknown>): Promise<Record<string, unknown>> {
      return this.request("POST", "/expenses", data);
    }
  • TypeScript type definition for CreateExpenseInput, which requires description and amount fields and optionally allows category, date, vendor, and taxDeductible fields.
    export type CreateExpenseInput = Pick<Expense, "description" | "amount"> &
      Partial<Pick<Expense, "category" | "date" | "vendor" | "taxDeductible">>;
Behavior3/5

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

Annotations already indicate this is a non-readOnly, non-destructive, non-idempotent, non-openWorld operation, covering basic behavioral traits. The description adds some context by mentioning it's for 'tracking business costs' and listing use cases, but doesn't disclose additional behavioral details like error handling, rate limits, or specific permission requirements beyond what annotations provide.

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 front-loaded with the core purpose and required parameters, followed by usage examples. However, the bilingual duplication (English/Spanish) adds redundancy without enhancing clarity for an AI agent, slightly reducing efficiency. Each sentence serves a purpose, but it could be more streamlined.

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 moderate complexity (6 parameters, mutation operation) and rich annotations, the description provides adequate context for basic use. However, with no output schema, it doesn't explain return values or success/error responses, leaving gaps in completeness. It covers the 'what' but not the full behavioral outcome.

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 each parameter well-documented in the input schema (e.g., amount in EUR, date format). The description only mentions 'description and amount' as required, which is already covered by the schema's required array. It doesn't add meaningful semantic context beyond what the structured schema provides, so baseline 3 is appropriate.

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 the verb ('Record'/'Registra') and resource ('expense'/'gasto'), specifying it's for creating new expenses. It distinguishes from siblings like update_expense or delete_expense by emphasizing 'new' creation, and from list_expenses/get_expense by focusing on recording rather than retrieval.

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 implied usage context ('Useful for tracking business costs, deductible expenses, and vendor payments'), which suggests when this tool might be appropriate. However, it doesn't explicitly state when to use this versus alternatives like update_expense or when not to use it, nor does it mention prerequisites beyond the required parameters.

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/Frihet-io/frihet-mcp'

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