get-shop
Retrieve Shopify store details including business information, settings, and configuration data through the Shopify MCP Server's GraphQL API.
Instructions
Get shop details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:513-523 (handler)Inline anonymous function that serves as the handler for the 'get-shop' tool. Instantiates ShopifyClient, fetches shop details via loadShop, and returns formatted JSON response or error.server.tool("get-shop", "Get shop details", {}, async () => { const client = new ShopifyClient(); try { const shop = await client.loadShop(SHOPIFY_ACCESS_TOKEN, MYSHOPIFY_DOMAIN); return { content: [{ type: "text", text: JSON.stringify(shop, null, 2) }], }; } catch (error) { return handleError("Failed to retrieve shop details", error); } });
- Core helper method loadShop in the ShopifyClient class responsible for making the REST API call to retrieve the shop object from Shopify Admin API.async loadShop( accessToken: string, shop: string ): Promise<LoadStorefrontsResponse> { const res = await this.shopifyHTTPRequest<LoadStorefrontsResponse>({ method: "GET", url: `https://${shop}/admin/api/${this.SHOPIFY_API_VERSION}/shop.json`, accessToken, }); return res.data; }
- src/index.ts:611-626 (helper)Helper utility function used in the get-shop handler to standardize error responses.function handleError( defaultMessage: string, error: unknown ): { content: { type: "text"; text: string }[]; isError: boolean; } { let errorMessage = defaultMessage; if (error instanceof CustomError) { errorMessage = `${defaultMessage}: ${error.message}`; } return { content: [{ type: "text", text: errorMessage }], isError: true, }; }
- src/index.ts:513-523 (registration)Registration of the 'get-shop' tool on the MCP server using server.tool method with empty schema and inline handler.server.tool("get-shop", "Get shop details", {}, async () => { const client = new ShopifyClient(); try { const shop = await client.loadShop(SHOPIFY_ACCESS_TOKEN, MYSHOPIFY_DOMAIN); return { content: [{ type: "text", text: JSON.stringify(shop, null, 2) }], }; } catch (error) { return handleError("Failed to retrieve shop details", error); } });