Skip to main content
Glama
iaptic

Iaptic MCP Server

Official
by iaptic

purchase_list

Retrieve a paginated list of purchases from your Iaptic account, filterable by date range or customer ID, with details on status, product, and transaction. Results sorted newest first.

Instructions

List purchases from your Iaptic account.

  • Returns a paginated list of purchases

  • Use limit and offset for pagination (default: 100 per page)

  • Filter by date range using startdate and enddate (ISO format)

  • Filter by customerId to see purchases from a specific customer

  • Results include purchase status, product info, and transaction details

  • Results are ordered by purchase date (newest first)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of purchases to return (default: 100, max: 1000)
offsetNoNumber of purchases to skip for pagination
startdateNoFilter purchases after this date (ISO format, e.g. 2024-01-01)
enddateNoFilter purchases before this date (ISO format, e.g. 2024-12-31)
customerIdNoFilter purchases by customer ID

Implementation Reference

  • The _handleTool method handles the 'purchase_list' case (lines 127-143). It calls this.api.getPurchases() with limit (capped at 1000), offset, startdate, enddate, customerId, and appName args, then returns the result as JSON text content.
    private async _handleTool(name: string, args: any) {
      switch (name) {
        case 'purchase_list':
          console.error(`Fetching purchases with params:`, args);
          const purchases = await this.api.getPurchases({
            limit: Math.min(args.limit || 100, 1000),  // Cap at 1000
            offset: args.offset,
            startdate: args.startdate,
            enddate: args.enddate,
            customerId: args.customerId,
            appName: args.appName
          });
          console.error(`Retrieved ${purchases.rows?.length || 0} purchases`);
          return {
            content: [{
              type: "text",
              text: JSON.stringify(purchases, null, 2)
            }]
          };
  • The public handleTool method handles app switching if using master key and appName is provided, then delegates to _handleTool.
    async handleTool(name: string, args: any) {
      const appInfo = this.api.getCurrentAppInfo();
      
      // If using master key and appName is provided, temporarily switch app
      if (appInfo.usingMasterKey && args.appName) {
        const currentApp = appInfo.appName;
        
        // Switch to the requested app
        this.api.switchApp('dummy-api-key', args.appName);
        
        try {
          // Execute the tool with the requested app
          const result = await this._handleTool(name, args);
          
          // Switch back to the original app
          this.api.switchApp('dummy-api-key', currentApp);
          
          return result;
        } catch (error) {
          // Make sure to switch back even if there's an error
          this.api.switchApp('dummy-api-key', currentApp);
          throw error;
        }
      }
      
      return this._handleTool(name, args);
    }
  • The inputSchema for purchase_list defines properties: limit (number), offset (number), startdate (string), enddate (string), customerId (string), and optionally appName (string) when using master key.
    inputSchema: {
      type: "object",
      properties: {
        limit: { 
          type: "number", 
          description: "Maximum number of purchases to return (default: 100, max: 1000)" 
        },
        offset: { 
          type: "number", 
          description: "Number of purchases to skip for pagination" 
        },
        startdate: { 
          type: "string", 
          description: "Filter purchases after this date (ISO format, e.g. 2024-01-01)" 
        },
        enddate: { 
          type: "string", 
          description: "Filter purchases before this date (ISO format, e.g. 2024-12-31)" 
        },
        customerId: { 
          type: "string", 
          description: "Filter purchases by customer ID" 
        },
        ...(appNameRequired ? {
          appName: {
            type: "string",
            description: "Name of the app to fetch data from. Required when using master key."
          }
        } : {})
      },
      required: appNameRequired ? ["appName"] : undefined
    }
  • The tool is registered inside the getTools() method (returned as part of an array). The name is 'purchase_list' with a description listing capabilities like pagination, date filtering, and customer filtering.
        return [
          {
            name: "purchase_list",
            description: `List purchases from your Iaptic account.
    - Returns a paginated list of purchases
    - Use limit and offset for pagination (default: 100 per page)
    - Filter by date range using startdate and enddate (ISO format)
    - Filter by customerId to see purchases from a specific customer
    - Results include purchase status, product info, and transaction details
    - Results are ordered by purchase date (newest first)${appNameRequired ? '\n- Requires appName parameter when using master key' : ''}`,
            inputSchema: {
              type: "object",
              properties: {
                limit: { 
                  type: "number", 
                  description: "Maximum number of purchases to return (default: 100, max: 1000)" 
                },
                offset: { 
                  type: "number", 
  • The getPurchases method on IapticAPI makes the actual HTTP GET request to '/purchases' endpoint, passing pagination and filter params. This is the underlying API call that the purchase_list handler invokes.
    async getPurchases(params?: ListParams & { customerId?: string }) {
      const defaultParams = {
        limit: 100,  // Reasonable default limit
        ...params
      };
      const response = await this.client.get('/purchases', { params: defaultParams });
      return response.data;
    }
Behavior4/5

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

With no annotations, the description fully bears the burden. It discloses pagination behavior, ordering (newest first), and result contents (status, product info, transaction details). No mention of side effects, but this is a read operation.

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 concise, using a bullet list format. Every sentence provides useful information without redundancy or filler.

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

Completeness5/5

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

Given no annotations or output schema, the description adequately covers pagination, filtering, ordering, and result content. It is complete enough for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so parameters are already documented. The description adds value by reinforcing usage patterns (e.g., ISO format for dates, pagination purpose) and ordering info, going beyond the schema.

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 action 'List purchases' and the resource 'from your Iaptic account'. It uses specific verbs and resources, and implicitly distinguishes from sibling tools like 'purchase_get' (single purchase) and 'customer_list'.

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?

Provides explicit guidance on pagination with limit/offset, filtering by date range and customerId, default page size, and ordering. Lacks explicit exclusions or when-not-to-use, but the context is clear.

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

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