get-shop-details
Retrieve comprehensive shop details, such as shipping countries, to support informed decisions and updates for Shopify store configurations.
Instructions
Get extended shop details including shipping countries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:553-571 (registration)Registers the MCP tool 'get-shop-details' with empty input schema and inline handler that calls ShopifyClient.loadShopDetailserver.tool( "get-shop-details", "Get extended shop details including shipping countries", {}, async () => { const client = new ShopifyClient(); try { const shopDetails = await client.loadShopDetail( SHOPIFY_ACCESS_TOKEN, MYSHOPIFY_DOMAIN ); return { content: [{ type: "text", text: JSON.stringify(shopDetails, null, 2) }], }; } catch (error) { return handleError("Failed to retrieve extended shop details", error); } } );
- Implements the core logic of fetching extended shop details (shipsToCountries) via GraphQL query in ShopifyClientasync loadShopDetail( accessToken: string, shop: string ): Promise<ShopResponse> { const myshopifyDomain = await this.getMyShopifyDomain(accessToken, shop); const graphqlQuery = gql` { shop { shipsToCountries } } `; const res = await this.shopifyGraphqlRequest<ShopResponse>({ url: `https://${myshopifyDomain}/admin/api/${this.SHOPIFY_API_VERSION}/graphql.json`, accessToken, query: graphqlQuery, }); return res.data; }
- Type definition for the response structure returned by loadShopDetailexport type ShopResponse = { data: { shop: { shipsToCountries: string[]; }; }; };
- Interface definition for loadShopDetail method in ShopifyClientPortloadShopDetail(accessToken: string, shop: string): Promise<ShopResponse>; }
- src/index.ts:639-654 (helper)Utility function used by tool handlers to format and return errors in MCP response 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, }; }