get_printify_status
Retrieve real-time status updates from Printify's print-on-demand platform using the MCP server, enabling seamless integration with AI assistants for product creation and design management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/services/printify-shops.ts:10-52 (handler)Core handler logic for get_printify_status: the getPrintifyStatus function that validates the client, fetches shops and current shop, and formats the status response.export async function getPrintifyStatus(printifyClient: PrintifyAPI) { try { // Validate client is initialized if (!printifyClient) { throw new Error('Printify API client is not initialized. The PRINTIFY_API_KEY environment variable may not be set.'); } // Get shops and current shop const shops = await printifyClient.getShops(); const currentShop = printifyClient.getCurrentShop(); return { success: true, shops, currentShop, response: { content: [{ type: "text", text: `Printify API Status:\n\n` + `Connected: Yes\n` + `Available Shops: ${shops.length}\n` + `Current Shop: ${currentShop ? `${currentShop.title} (ID: ${currentShop.id})` : 'None'}` }] } }; } catch (error: any) { console.error('Error getting Printify status:', error); return { success: false, error, errorResponse: formatErrorResponse( error, 'Get Printify Status', {}, [ 'Check that your Printify API key is valid', 'Ensure your Printify account is properly connected' ] ) }; } }
- src/index.ts:87-115 (registration)Registration of the 'get_printify_status' tool via server.tool(). The inline handler checks client initialization and delegates to the getPrintifyStatus service function, returning formatted response.server.tool( "get_printify_status", {}, async ({}): Promise<{ content: any[], isError?: boolean }> => { // Import the printify shops service const { getPrintifyStatus } = await import('./services/printify-shops.js'); // Check if client is initialized if (!printifyClient) { return { content: [{ type: "text", text: "Printify API client is not initialized. The PRINTIFY_API_KEY environment variable may not be set." }], isError: true }; } // Call the service const result = await getPrintifyStatus(printifyClient); // Return the result if (result.success) { return result.response as { content: any[], isError?: boolean }; } else { return result.errorResponse as { content: any[], isError: boolean }; } } );