Skip to main content
Glama
jdlar1

Siigo MCP Server

by jdlar1

siigo_create_purchase

Create new purchase records in Siigo accounting software to manage procurement transactions and maintain accurate financial records.

Instructions

Create a new purchase

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
purchaseYesPurchase data

Implementation Reference

  • MCP tool handler for siigo_create_purchase. Extracts purchase data from args and delegates to SiigoClient.createPurchase, then formats and returns the result as text content.
    private async handleCreatePurchase(args: any) {
      const result = await this.siigoClient.createPurchase(args.purchase);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Tool schema definition including name, description, and input schema for creating a purchase.
    {
      name: 'siigo_create_purchase',
      description: 'Create a new purchase',
      inputSchema: {
        type: 'object',
        properties: {
          purchase: { type: 'object', description: 'Purchase data' },
        },
        required: ['purchase'],
      },
    },
  • src/index.ts:120-121 (registration)
    Registration of the tool handler in the switch statement within CallToolRequestSchema handler.
      return await this.handleCreatePurchase(args);
    case 'siigo_update_purchase':
  • SiigoClient method that performs the actual API call to create a purchase by POSTing to /v1/purchases.
    async createPurchase(purchase: any): Promise<SiigoApiResponse<any>> {
      return this.makeRequest<any>('POST', '/v1/purchases', purchase);
    }
  • Core helper method in SiigoClient that handles authentication, makes HTTP requests to Siigo API, and processes responses/errors.
    private async makeRequest<T>(method: string, endpoint: string, data?: any, params?: any): Promise<SiigoApiResponse<T>> {
      await this.authenticate();
    
      try {
        const response: AxiosResponse<SiigoApiResponse<T>> = await this.httpClient.request({
          method,
          url: endpoint,
          data,
          params,
        });
    
        return response.data;
      } catch (error: any) {
        if (error.response?.data) {
          return error.response.data;
        }
        throw new Error(`API request failed: ${error.message}`);
      }
    }

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/jdlar1/siigo-mcp'

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