Issue with MCP Tool Input Schema in AI Agent Using GraphQL (Shopify Integration)

Describe the problem/error/question

I’m trying to build an AI Agent in n8n that can fetch order information from Shopify via a GraphQL query. The agent is integrated with Slack, and it communicates with a n8n MCP server in another workflow.

The tool I’m using getSubscriptionRetailValue is supposed to pass an orderID as a parameter to a GraphQL node, which looks like this:

query getOrder($orderID: String!) {
  order(id: $orderID) {
    currentSubtotalLineItemsQuantity
    lineItems(first: 10) {
      edges {
        node {
          name
          originalUnitPriceSet {
            presentmentMoney {
              amount
            }
          }
        }
      }
    }
  }
}

The variable field is configured as “Defined automatically by the model”

What is the error message (if any)?

When the Agent node calls the MCP client, I get the following error in MCP client:

Failed to execute tool "getSubscriptionRetailValue"
Error: Received tool input did not match expected schema

Share the output returned by the last node

However, the log shows the input seems valid:

{
  "query": {
    "orderID": "gid://shopify/Order/43xxxxxx23"
  },
  "tool": {
    "name": "getSubscriptionRetailValue",
    "description": "Retrieve the retail value of the products included in an order from an order id. Use the order id from a new subscription as a parameter\nKeyword to be used to provide the order id is the following \"orderID\"\nThis orderID must follow this format \"gid://shopify/Order/47xxxxx54\""
  }
}

How can I resolve this schema mismatch?
Is there a specific format or schema declaration I need to apply for the orderID parameter inside the Agent tool or the MCP server workflow?

Thanks in advance!

Information on your n8n setup

  • n8n version: Cloud version [email protected]
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.