Skip to main content
Glama
andymillar84-cyber

mcp-cliniko

list_invoice_items

Retrieve all line items for a specific invoice. Use this read-only function to view invoice item details.

Instructions

List items in an invoice (READ-ONLY)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoice_idYesInvoice ID

Implementation Reference

  • The async handler function that executes the 'list_invoice_items' tool logic. Calls client.listInvoiceItems(invoice_id), maps items to display text, and returns the result.
    }, async ({ invoice_id }: { invoice_id: number }) => {
      try {
        const result = await client.listInvoiceItems(invoice_id);
        const items = result.invoice_items || [];
        
        return {
          content: [{
            type: 'text',
            text: `Invoice #${invoice_id} has ${items.length} items:\n\n` +
              items.map((item: any) => 
                `- ${item.description}: $${item.unit_price} x ${item.quantity} = $${item.total}`
              ).join('\n')
          }],
          data: result
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error fetching invoice items: ${error instanceof Error ? error.message : String(error)}`
          }]
        };
      }
    });
  • Registration of the 'list_invoice_items' tool via server.tool() with input schema requiring invoice_id (number). Defined inside registerInvoiceTools() function.
    server.tool('list_invoice_items', {
      description: 'List items in an 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 result = await client.listInvoiceItems(invoice_id);
        const items = result.invoice_items || [];
        
        return {
          content: [{
            type: 'text',
            text: `Invoice #${invoice_id} has ${items.length} items:\n\n` +
              items.map((item: any) => 
                `- ${item.description}: $${item.unit_price} x ${item.quantity} = $${item.total}`
              ).join('\n')
          }],
          data: result
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error fetching invoice items: ${error instanceof Error ? error.message : String(error)}`
          }]
        };
      }
    });
  • Input schema for the tool: object type with required invoice_id number property.
    inputSchema: {
      type: 'object',
      properties: {
        invoice_id: { type: 'number', description: 'Invoice ID' }
      },
      required: ['invoice_id']
    },
  • Client method listInvoiceItems that makes the actual HTTP GET request to /invoices/{invoiceId}/invoice_items.
    async listInvoiceItems(invoiceId: number): Promise<ClinikoListResponse<InvoiceItem>> {
      return this.request<ClinikoListResponse<InvoiceItem>>(`/invoices/${invoiceId}/invoice_items`);
    }
  • TypeScript InvoiceItem interface defining the shape of invoice item objects returned by the API.
    export interface InvoiceItem {
      id: number;
      invoice_id: number;
      description: string;
      unit_price: number;
      quantity: number;
      discount_percentage: number;
      discount_amount: number;
      tax_amount: number;
      net_amount: number;
      total_amount: number;
      product?: {
        id: number;
        name: string;
      };
      tax?: {
        id: number;
        name: string;
        rate: number;
      };
      created_at: string;
      updated_at: string;
      links?: {
        self: string;
        invoice: string;
      };
    }
Behavior2/5

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

No annotations provided, so description must cover behavioral traits. '(READ-ONLY)' indicates no side effects, but lacks details on pagination, sorting, error handling, or whether it returns all items or a subset.

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?

Extremely concise—one short phrase. No wasted words, but could be structured as a full sentence to improve readability. Efficient for simple tool.

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 single parameter, no output schema, and no annotations, the description is minimal but adequate. Lacks details on return value structure, error cases, or usage hints. Could be improved with one or two more sentences.

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% (parameter 'invoice_id' documented). Description adds '(READ-ONLY)' but no additional param meaning. Baseline 3 for high coverage.

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 'List items in an invoice' with a specific verb and resource, and the '(READ-ONLY)' suffix distinguishes it from mutation tools like create/update/delete. It differentiates from sibling 'list_invoices' by specifying granularity.

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 on when to use this tool versus alternatives. Does not mention prerequisites (e.g., must have invoice_id from get_invoice) or context where it is appropriate or not.

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