Skip to main content
Glama

siigo_create_purchase

Create a new purchase record in Siigo accounting software to track business expenses and maintain accurate financial records.

Instructions

Create a new purchase

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
purchaseYesPurchase data

Implementation Reference

  • MCP server handler method that extracts args.purchase and delegates to SiigoClient.createPurchase, then formats response as MCP content.
    private async handleCreatePurchase(args: any) { const result = await this.siigoClient.createPurchase(args.purchase); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • Core implementation of purchase creation: authenticates, makes POST request to Siigo API /v1/purchases endpoint with purchase data.
    async createPurchase(purchase: any): Promise<SiigoApiResponse<any>> { return this.makeRequest<any>('POST', '/v1/purchases', purchase);
  • Input schema defining the expected structure for tool arguments: an object containing 'purchase' data.
    { name: 'siigo_create_purchase', description: 'Create a new purchase', inputSchema: { type: 'object', properties: { purchase: { type: 'object', description: 'Purchase data' }, }, required: ['purchase'], }, },
  • src/index.ts:119-120 (registration)
    Switch case in CallToolRequestSchema handler that routes 'siigo_create_purchase' calls to the specific handler method.
    case 'siigo_create_purchase': return await this.handleCreatePurchase(args);
  • Generic helper method used by all API calls: handles authentication, makes Axios request, processes response or error.
    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