Skip to main content
Glama

open_invoice

Idempotent

Change an invoice from concept to open state by assigning its invoice number, preparing it for sending.

Instructions

Changes the state from concept to open. This will assign the actual invoice number so it's ready for sending. If the current state is not concept, this endpoint does nothing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the invoice

Implementation Reference

  • Tool registration for 'open_invoice' using server.registerTool. Defines description, annotations, and inputSchema.
    server.registerTool(
      "open_invoice",
      {
        description:
          "Changes the state from concept to open.\nThis will assign the actual invoice number so it's ready for sending.\nIf the current state is not concept, this endpoint does nothing.\n",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: { id: z.number().int().positive().describe("ID of the invoice") },
      },
      async ({ id }) => {
        try {
          const record = await apiPost<EduframeRecord>(`/invoices/${id}/open`, {});
          void logResponse("open_invoice", { id }, record);
          return formatShow(record, "invoice");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Handler function for 'open_invoice'. Calls POST /invoices/{id}/open to change invoice state from concept to open, logs the response, and formats the result.
      async ({ id }) => {
        try {
          const record = await apiPost<EduframeRecord>(`/invoices/${id}/open`, {});
          void logResponse("open_invoice", { id }, record);
          return formatShow(record, "invoice");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Input schema for 'open_invoice': requires a positive integer 'id' field (the invoice ID).
    {
      description:
        "Changes the state from concept to open.\nThis will assign the actual invoice number so it's ready for sending.\nIf the current state is not concept, this endpoint does nothing.\n",
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
      inputSchema: { id: z.number().int().positive().describe("ID of the invoice") },
  • The apiPost helper used by the handler to POST to /invoices/{id}/open. Sends a POST request with JSON body and returns parsed response.
    export async function apiPost<T>(path: string, body: unknown): Promise<T> {
      const { token } = getConfig();
      const url = buildUrl(path);
    
      const response = await fetch(url.toString(), {
        method: "POST",
        headers: buildHeaders(token),
        body: JSON.stringify(body),
      });
    
      return handleResponse<T>(response);
    }
  • The formatShow helper used by the handler to format the invoice record as a text response.
    export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult {
      return {
        content: [
          {
            type: "text",
            text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`,
          },
        ],
      };
    }
Behavior4/5

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

Beyond the idempotentHint annotation, the description adds that the tool assigns an invoice number and makes the invoice ready for sending, and it does nothing if the state is not concept. This gives useful context about the tool's effects.

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 brief and well-structured: three sentences that state the action, its effect, and a conditional note. No extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a state-change tool with no output schema, the description adequately explains the behavior and conditions. It could mention error handling (e.g., if invoice ID is invalid), but overall it is sufficient.

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?

The input schema is fully covered with a description for the single 'id' parameter. The tool description does not add additional parameter-level details, so the baseline of 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 tool changes invoice state from concept to open and assigns an invoice number. It is distinct from sister tools like create_invoice or get_invoice, making its purpose unambiguous.

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

Usage Guidelines4/5

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

The description explicitly states that the endpoint does nothing if the current state is not concept, providing a clear precondition for use. While it doesn't mention alternatives, the behavior is well-defined for when to call it.

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/martijnpieters/eduframe-mcp'

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