# Mechanic code snippets

### `bulk_operation_query` - GraphQL bulk operation query template <a href="#bulk_operation_query" id="bulk_operation_query"></a>

This snippet expands to provide a complete template for initiating a bulk operation query and responding to the results (see [Bulk operations](/core/shopify/bulk-operations.md)). Use it from the top level of a new task after defining the task option fields.

Once the snippet is selected, you will be prompted to select a resource name, which must be in camel case (e.g. `productVariant`). You can type in your own resource name if it doesn't appear in the list. This value will be propagated throughout most of the snippet block.

Hitting `tab` after choosing the initial resource name, you will again be prompted to choose a resource name, this time to be used within the sample JSONL preview block and the resource assignment by `__typename` afterwards. This resource name needs to be in Pascal case to align with Shopify resource identifiers (e.g. `ProductVariant`).

<figure><img src="/files/6eTEPXY5HUfeCV0ttXtR" alt=""><figcaption></figcaption></figure>

***

### `gid` - Shopify global ID <a href="#gid" id="gid"></a>

Expands inline to provide an example [gid](https://shopify.dev/docs/api/usage/gids) with the resource object you choose. You may also type your resource object if there is not a match in the list.

This snippet is most useful when generating stub/preview data for a GraphQL query.

<figure><img src="/files/2ApPUmthlkJbd2RP5OWH" alt=""><figcaption></figcaption></figure>

***

### `object_query` - GraphQL object query <a href="#object_query" id="object_query"></a>

This snippet can be used when you want to query a single top-level resource in GraphQL.

Once the snippet is selected, you will be prompted to select a resource name, which must be in camel case (e.g. `productVariant`). You can type in your own resource name if it doesn't appear in the list. This value will be propagated throughout most of the snippet block.

Hitting `tab` after choosing the initial resource name, you will again be prompted to choose a resource name, this time only for use within the sample preview block. This resource name needs to be in Pascal case to align with Shopify resource identifiers (e.g. `ProductVariant`).

<figure><img src="/files/zLYrCscGQ3jhPCd6OYEg" alt=""><figcaption></figcaption></figure>

***

### `paginated_query` - GraphQL paginated query <a href="#paginated_query" id="paginated_query"></a>

Use this snippet to provide a paginated query for a resource within a for loop block. It will prompt you to choose the resource type.

<figure><img src="/files/ncH1jUpKE6cXXLz1ARph" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.mechanic.dev/platform/liquid/mechanic-code-snippets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
