get-shop
Retrieve Shopify store details including configuration, settings, and business information to manage store operations.
Instructions
Get shop details
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-shop"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:541-551 (handler)The main handler function for the 'get-shop' tool. It instantiates a ShopifyClient, calls loadShop with the access token and shop domain, stringifies the shop data, and returns it in the expected MCP format. Handles errors using handleError.
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); } }); - src/index.ts:541-551 (registration)Registers the 'get-shop' tool on the MCP server with description 'Get shop details' and empty input schema.
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 implementation of shop data retrieval via HTTP GET request to Shopify's /admin/api/{version}/shop.json endpoint using shopifyHTTPRequest method.
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:639-654 (helper)Utility function used by the get-shop handler to format and return error responses in MCP format.
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, }; }