Skip to main content
Glama
andymillar84-cyber

mcp-cliniko

get_invoice

Retrieve detailed information for a specific invoice using its ID. Enables read-only access to invoice data in Cliniko.

Instructions

Get details of a specific invoice (READ-ONLY)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoice_idYesInvoice ID

Implementation Reference

  • The tool handler for 'get_invoice'. It accepts an invoice_id, calls client.getInvoice(), and returns formatted invoice details including number, patient, practitioner, status, issue date, total, and item count.
      server.tool('get_invoice', {
        description: 'Get details of a specific invoice (READ-ONLY)',
        inputSchema: {
          type: 'object',
          properties: {
            invoice_id: { type: 'number', description: 'Invoice ID' }
          },
          required: ['invoice_id']
        },
      }, async ({ invoice_id }: { invoice_id: number }) => {
        try {
          const invoice = await client.getInvoice(invoice_id);
          
          return {
            content: [{
              type: 'text',
              text: `Invoice #${invoice.invoice_number || invoice.id}:
    - Patient: ${invoice.patient?.name}
    - Practitioner: ${invoice.practitioner?.name}
    - Status: ${invoice.status}
    - Issue Date: ${invoice.issued_at}
    - Total: $${invoice.total || 0}
    - Items: ${invoice.invoice_items?.length || 0} items`
            }],
            data: invoice
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error fetching invoice: ${error instanceof Error ? error.message : String(error)}`
            }]
          };
        }
      });
  • Input schema for the get_invoice tool: requires invoice_id (number).
    description: 'Get details of a specific invoice (READ-ONLY)',
    inputSchema: {
      type: 'object',
      properties: {
        invoice_id: { type: 'number', description: 'Invoice ID' }
      },
      required: ['invoice_id']
    },
  • src/index.ts:10-63 (registration)
    The tool is registered in index.ts by importing registerInvoiceTools from './tools/invoices.js' and calling it at line 62.
    import { registerInvoiceTools } from './tools/invoices.js';
    import { registerDemoInvoiceTools } from './tools/demo-invoice-generation.js';
    import { registerResources } from './resources/index.js';
    
    const API_KEY = process.env.CLINIKO_API_KEY;
    
    if (!API_KEY) {
      // Exit silently if no API key - MCP protocol doesn't allow stderr output
      process.exit(1);
    }
    
    // Initialize MCP server
    const server = new Server(
      {
        name: 'mcp-cliniko',
        version: '1.0.0',
      },
      {
        capabilities: {
          tools: {},
          resources: {},
          prompts: {},
        },
      }
    );
    
    // Initialize Cliniko client
    const clinikoClient = new ClinikoClient(API_KEY);
    
    // Track registered tools and resources
    const tools = new Map();
    const resources = new Map();
    
    // Helper to register tools
    const toolRegistry = {
      tool(name: string, schema: any, handler: any) {
        tools.set(name, { schema, handler });
      }
    };
    
    // Helper to register resources
    const resourceRegistry = {
      resource(uriTemplate: string, options: any, handler: any) {
        resources.set(uriTemplate, { ...options, handler, uriTemplate });
      }
    };
    
    // Register all tools
    registerPatientTools(toolRegistry, clinikoClient);
    registerAppointmentTools(toolRegistry, clinikoClient);
    registerSyntheticDataTools(toolRegistry, clinikoClient);
    registerEnhancedSyntheticDataTools(toolRegistry, clinikoClient);
    registerInvoiceTools(toolRegistry, clinikoClient);
    registerDemoInvoiceTools(toolRegistry, clinikoClient);
  • The ClinikoClient.getInvoice(id) method that performs the HTTP GET request to /invoices/{id} and returns the Invoice object.
    async getInvoice(id: number): Promise<Invoice> {
      return this.request<Invoice>(`/invoices/${id}`);
    }
  • TypeScript interface for Invoice, defining all fields returned from the API including patient, practitioner, business, invoice_items, etc.
    export interface Invoice {
      id: number;
      invoice_number?: string;
      issued_at: string;
      due_at?: string;
      status: 'draft' | 'awaiting_payment' | 'part_paid' | 'paid' | 'void' | 'write_off';
      total: number;
      tax_total: number;
      subtotal: number;
      amount_paid: number;
      amount_outstanding: number;
      notes?: string;
      payment_terms?: number;
      patient: {
        id: number;
        name: string;
        links: {
          self: string;
        };
      };
      practitioner: {
        id: number;
        name: string;
        links: {
          self: string;
        };
      };
      business: {
        id: number;
        name: string;
        links: {
          self: string;
        };
      };
      invoice_items?: InvoiceItem[];
      created_at: string;
      updated_at: string;
      links?: {
        self: string;
        patient: string;
        practitioner: string;
        invoice_items?: string;
        payments?: string;
      };
    }
Behavior3/5

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

With no annotations, the description solely bears the burden. It notes the tool is READ-ONLY, a key behavioral trait. However, it lacks details on authorization, error conditions, or the scope of 'details' returned.

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 a single, front-loaded sentence of 8 words with no extraneous information. Every word earns its place.

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?

For a simple single-parameter retrieval tool, the description is adequate but could be improved by indicating what fields are returned (no output schema). It lacks completeness regarding the response structure.

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 coverage is 100%, and the only parameter 'invoice_id' is clearly described in the schema. The description does not add semantics beyond the schema, earning the baseline 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?

Description clearly states 'Get details of a specific invoice (READ-ONLY)', specifying the verb, resource, and read-only nature. It distinguishes from sibling tools like list_invoices (which lists multiple) and get_appointment_invoices (which retrieves invoices by appointment).

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It does not mention when not to use it, prerequisites, or context for selection among siblings.

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/andymillar84-cyber/mcp-cliniko'

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