Skip to main content

Ask MCP

Use Ask MCP to answer buyer questions about a store's products, policies, and services. The ask_business tool returns an answer from the store's knowledge base, policies, and product information.

Supported versions

Ask is available in UCP 2026-08-25 and draft. Your agent profile must use one of these versions and declare dev.ucp.common.ask.


Use Ask when a buyer asks about specific products, a store's return policy, shipping options, warranties, or services. Include relevant buyer context, such as their country or preferred language, with the question.

Ask answers questions. It doesn't change carts, place orders, or start returns. To look up products, prices, and availability, use Storefront Catalog MCP.


Ask provides one tool:

  • ask_business: Answer questions about the store's products, policies, and services.

Replace {storedomain} with the store's actual domain. The /api/ucp/mcp endpoint requires an agent profile. Every JSON-RPC 2.0 request must include the profile URL in params.arguments.meta["ucp-agent"].profile. The returned tools depend on the capabilities your agent advertises.

UCP Ask specification

This tool implements the Universal Commerce Protocol Ask specification and its MCP binding. Refer to the UCP specification for the complete request and response schemas.

Check the store's UCP profile at https://{storedomain}/.well-known/ucp for dev.ucp.common.ask and the MCP endpoint under the dev.ucp.common service.

Use tools/list to check whether the store offers ask_business for your agent profile.

For authentication and request limits, refer to Auth and rate limiting.

POST

https://{storedomain}/api/ucp/mcp

{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1,
"params": {
"arguments": {
"meta": {
"ucp-agent": {
"profile": "https://shopify.dev/ucp/agent-profiles/examples/draft/ask.json"
}
}
}
}
}

For testing, use Shopify's example Ask profile. Host your own profile for your integration.

Ask a question about the store. The response contains the answer in result.structuredContent.answer.plain. The result.content array also contains a text representation of the response.

ParameterTypeRequiredDescription
metaobjectYesUCP metadata, including ucp-agent.profile for capability negotiation.
askobjectYesThe question, with optional resource IDs and buyer context.
ask.querystringYesA natural-language question. Maximum: 10,000 characters.
ask.idsstring[]NoResource GIDs from this store. Ask uses up to 10 supported IDs.
ask.contextobjectNoBuyer context. The serialized JSON object must not exceed 8,192 bytes.

For questions about specific products, include the relevant IDs in ask.ids so Ask can use the store's product information. Use product or variant IDs from Storefront Catalog MCP. Global Catalog product IDs in the format gid://shopify/p/... aren't supported.

ID typeExampleInformation used
Productgid://shopify/Product/123Product details.
ProductVariantgid://shopify/ProductVariant/456The variant's selected options, price, and availability.
Collectiongid://shopify/Collection/789The first products in collection order.
Cartgid://shopify/Cart/{token}?key={key}Variants from the cart's line items.

Use the full cart ID returned by create_cart, including its key query parameter. Ask reads the cart without changing it.

Ask uses at most 10 product or variant IDs to answer the question. Explicit product and variant IDs take priority. Cart and collection contents fill the remaining slots in request order.

The following string fields are available in ask.context:

FieldDescription
address_countryThe buyer's country, for example, US.
address_regionThe buyer's state or region, for example, CA.
postal_codeThe buyer's postal code.
languageThe preferred language, for example, en.
currencyThe preferred currency, for example, USD.
intentAdditional context about what the buyer wants to do.

The context object also accepts additional properties. Send only the context needed to answer the question.

The example response uses an illustrative return policy and product URL. It shows result.structuredContent and omits other UCP metadata and the MCP text representation.

POST

https://{storedomain}/api/ucp/mcp

{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 2,
"params": {
"name": "ask_business",
"arguments": {
"meta": {
"ucp-agent": {
"profile": "https://shopify.dev/ucp/agent-profiles/examples/draft/ask.json"
}
},
"ask": {
"query": "What is the return policy for this product?",
"ids": ["gid://shopify/ProductVariant/456"],
"context": {
"address_country": "US",
"language": "en"
}
}
}
}
}

Response excerpt

{
"ucp": {
"version": "draft"
},
"answer": {
"plain": "You can return eligible items within 30 days of delivery. Items must be unused and in their original packaging."
},
"links": [
{
"type": "product",
"url": "https://store.example.com/products/example-product?variant=456",
"title": "Example product - Blue / Large",
"id": "gid://shopify/ProductVariant/456"
}
]
}

The response can include result.structuredContent.links for product, variant, and collection IDs provided in ask.ids. Each link contains type, url, title, and the resource GID in id. The type is product for products and variants, or collection for collections.

Links are available only for resources with an online store URL. Variant URLs select the referenced variant on the product page. Cart IDs don't get links. Products added through carts or collections don't get links unless you also pass their product or variant IDs.


Anchor to Add knowledge for AskAdd knowledge for Ask

Merchants manage the store information that Ask uses to answer buyer questions on the Knowledge base page of the Sales channels > Agentic section in the Shopify admin. They review and edit facts there, including facts that Shopify generates and facts that apps write.

When the Shopify admin creates an additional fact, it doesn't set category, source, or external_id.

Anchor to Manage knowledge base facts with the GraphQL Admin APIManage knowledge base facts with the GraphQL Admin API

Your app can also sync facts, such as FAQs, policies, and service details, with the GraphQL Admin API. Each fact is a shopify--knowledge-base-fact metaobject, and Ask uses these facts when it answers ask_business questions. For the full field list, refer to standard metaobject definitions.

Your app needs the write_metaobjects access scope.

  1. Create a fact with metaobjectCreate. Set title to the question and value_string to the answer.
  2. Save the metaobject id that the mutation returns.
  3. To change the fact later, pass that id to metaobjectUpdate.

The following example creates an FAQ fact:

Create an FAQ fact

mutation CreateKnowledgeBaseFact($metaobject: MetaobjectCreateInput!) {
metaobjectCreate(metaobject: $metaobject) {
metaobject {
id
}
userErrors {
field
message
code
}
}
}
{
"metaobject": {
"type": "shopify--knowledge-base-fact",
"fields": [
{"key": "title", "value": "Do you offer gift wrapping?"},
{
"key": "value_string",
"value": "Yes. Select gift wrapping at checkout for eligible items."
},
{"key": "published", "value": "true"},
{"key": "source", "value": "manual"}
]
}
}

When you create the first fact, metaobjectCreate enables the standard definition if the store doesn't already have it. You don't need to call standardMetaobjectDefinitionEnable first.

Follow these rules when you sync facts:

  • Set the required published field to true. Ask skips unpublished facts and facts that have an empty title or answer.
  • Set only one of the value_string, value_string_list, value_boolean, or value_number fields.
  • Set source to manual when creating new facts. Don't use storefront or admin. Shopify reserves these sources for generated facts.
  • Leave the Shopify-managed value_reference field empty. Don't write suggested_* fields or suggestion_state. Suggestions await merchant review, and Ask never reads suggested_* fields.
  • A store can have up to 1,000 facts in total, from the merchant, from Shopify, and from all apps. Each title must be unique in the store.
  • Ask reads facts live on each request. Updates don't need reindexing.
  • Update or delete only facts that your app created. Use the saved id to identify each fact instead of matching by title. When you remove an FAQ from your app, pass its saved id to metaobjectDelete.
Don't store sensitive information

This definition has PUBLIC_READ_WRITE access through the GraphQL Admin API. Any app installed on the store with read_metaobjects can read its facts. Apps with write_metaobjects can change or delete them. Don't store private or sensitive information.

Test with a question and answer from your development store. To review an existing definition's fields and validation rules, use metaobjectDefinitionByType with the read_metaobject_definitions access scope.

Send the mutation to https://{shop}.myshopify.com/admin/api/{api_version}/graphql.json. Check userErrors, and then confirm the fact's content and published status in Sales channels > Agentic > Knowledge base.

To verify retrieval, use the store's UCP profile and an Ask-capable agent profile as described in Available tools. Call ask_business at /api/ucp/mcp with ask.query set to the question you published, such as Do you offer gift wrapping?. Compare result.structuredContent.answer.plain with the published fact, and inspect errors and result.structuredContent.messages. A non-empty answer alone doesn't confirm retrieval. The deprecated search_shop_policies_and_faqs tool doesn't read knowledge base facts, so you can't use it to verify them.


  • Each request contains one question. Multi-turn conversations aren't supported. Include the context needed for the current question.
  • The answer text is plain text in answer.plain. Don't depend on Markdown or conversation identifiers in the response.

A valid request can return an answer that explains why Ask can't help. An answer doesn't always mean that the store has information for the question. An empty question also returns an answer that asks for a question.

Handle JSON-RPC errors and inspect UCP messages in result.structuredContent.messages:

The unsupported_id and id_limit_exceeded codes use type: "warning". The not_found code uses type: "info". Each ID message includes a path, such as $.ask.ids[2], that identifies the input ID.

CodeMeaningAction
invalid_inputThe question or context exceeds its limit, or the required ask object is missing.Correct the request before sending it again.
ask_unavailableAsk couldn't complete the request. The response includes an unavailable answer and a recoverable message.Tell the buyer that an answer isn't available.
unsupported_idThe ID type or format isn't supported.Use a supported GID from this store.
id_limit_exceededAn ID is past the 10-ID limit, or not all cart items fit the product limit.Send fewer IDs, or pass explicit product or variant IDs for the items needed.
not_foundThe resource isn't available from this store, or the cart key doesn't match.Check the resource ID and cart key.

Was this page helpful?