MCIP
Server

MCP Tools

MCIP provides five powerful MCP tools that AI agents use to search products, manage carts, and handle commerce interactions. Each tool is validated, type-safe, and returns consistent responses in under 500ms.

Tools Are Your AI Agent's Vocabulary

Think about learning a new language. You don't memorize the entire dictionary on day one. Instead, you learn essential phrases first: "Hello," "Thank you," "Where is the bathroom?" These key phrases let you navigate basic situations immediately.

MCP tools are like those essential phrases for AI agents entering the world of e-commerce. Instead of learning every possible API endpoint, query parameter, and response format across hundreds of platforms, AI agents learn five simple tools. With just these five tools, they can search any product, manage any cart, complete any commerce task.

But here's the beautiful part: these aren't just simple commands. Each tool is intelligent, validated, and adaptive. They understand context, handle errors gracefully, and always return predictable responses. It's like having a universal remote that works with every TV ever made – same buttons, different channels.


The Magnificent Five: Your Complete Commerce Toolkit

Tool #1: search_product - The Explorer

What it does: Searches for products using natural language, just like a human would.

Imagine walking into a massive department store and telling a personal shopper, "I need something nice for my sister's wedding, maybe in blue, nothing over $200." The personal shopper doesn't need you to specify exact categories, brands, or departments. They understand context, intent, and constraints.

That's exactly what search_product does. When an AI agent says "gaming laptop for a college student on a budget," search_product understands this means reasonable price, portable, good enough for games but suitable for schoolwork. It's not just matching keywords – it's understanding intent.

The tool accepts natural language queries and optional filters. But here's what makes it special: it uses RAG (Retrieval-Augmented Generation) to understand semantic meaning. "Affordable" becomes a price range based on the product category. "Gaming" implies certain specifications. "College student" suggests portability matters. All this intelligence happens automatically.

Behind the scenes, search_product orchestrates a complex dance: generating embeddings, searching vectors, querying platforms, normalizing results. But to the AI agent, it's simple: ask a question, get relevant products. The complexity is hidden, the interface is clean.

Tool #2: add_to_cart - The Collector

What it does: Adds products to a session-based shopping cart that persists across the conversation.

Shopping isn't a single action – it's a journey. You browse, you compare, you add things, you remove things, you come back later. The add_to_cart tool understands this journey nature of shopping.

When an AI agent adds a product to the cart, it's not just storing an ID in memory. The tool manages a full session context that survives across multiple interactions. The user can say "add the blue one" after discussing several products, and the tool knows exactly which blue one they mean because it maintains conversation context.

Each cart is isolated to a session, like having your own personal shopping basket that no one else can see or touch. The session persists for 24 hours, so users can come back later and continue where they left off. It's the digital equivalent of a store holding your items at customer service while you grab lunch.

The tool handles all the edge cases elegantly. Adding a product that's already in the cart? It increases quantity. Product out of stock? Clear error message with alternatives. Price changed since browsing? User gets notified. This isn't just data storage – it's intelligent cart management.

Tool #3: view_cart - The Reviewer

What it does: Shows the current cart contents with real-time pricing and availability.

There's a moment in every shopping experience where you pause and review what you've collected. Maybe you're checking the total. Maybe you're having second thoughts about that impulse add. Maybe you just want to see everything together before committing.

The view_cart tool provides this crucial pause moment. But it doesn't just list items – it provides a complete snapshot of the cart's current state. Prices are verified against current platform data (remember, no stale data in MCIP). Availability is checked. Totals are calculated. It's like having a personal accountant review your selections.

What makes this tool particularly clever is its handling of changes. If a price increased since the item was added, the tool shows both the original and current price. If something went out of stock, it's flagged but not removed (maybe it'll come back). If there are related promotions or bundles, they're highlighted. It's not just showing data – it's providing shopping intelligence.

Tool #4: update_cart_item - The Editor

What it does: Modifies quantities or removes items from the cart with surgical precision.

We've all been there. You added three, but actually need five. You picked the blue one but meant to get red. You got excited and added too much, now you need to trim back. Shopping is iterative, and update_cart_item makes iteration painless.

This tool is like having an undo button with infinite granularity. Want to change quantity? Simple. Remove a specific item? Done. Clear everything and start over? That's actually tool #5, but we're getting ahead of ourselves.

The beauty is in the precision. You can update a single variant of a single product without affecting anything else. The tool maintains cart integrity throughout – it won't let you set negative quantities, it validates against available stock, it recalculates totals automatically. Every update is atomic and safe.

Tool #5: clear_cart - The Fresh Start

What it does: Empties the cart completely, providing a clean slate.

Sometimes you need to start over. Maybe you were browsing for someone else and now want to shop for yourself. Maybe you were comparison shopping and now want to begin your actual purchase. Maybe you just changed your mind about everything.

The clear_cart tool provides instant tabula rasa. One call, empty cart. No confirmations, no complexity, just a fresh start. It's like putting all items back on the shelf and walking to a different department.

But here's a subtle brilliance: clearing the cart doesn't clear the session. Search history, preferences, and context remain. So if you clear your cart and then search for "that laptop from earlier," the system still knows what you're talking about. It's forgetting the right things while remembering what matters.


Tool Registration: How AI Agents Discover Capabilities

The Introduction Ceremony

When an AI agent first connects to MCIP, something beautiful happens. It's like walking into a workshop and having all the tools introduce themselves: "Hi, I'm the hammer, I drive nails." "I'm the saw, I cut wood." "I'm the level, I ensure things are straight."

MCIP's tools announce themselves through the MCP protocol's discovery mechanism. Each tool provides its name, a human-readable description, and a detailed schema of what parameters it accepts. This isn't just documentation – it's executable specification. The AI agent knows exactly how to use each tool before making its first call.

The registration process happens automatically when an agent connects. There's a special meta-tool called tools/list that returns all available tools. It's like asking "What can you do?" and getting a comprehensive answer. This dynamic discovery means new tools can be added without breaking existing integrations. The protocol evolves gracefully.

Speaking the Same Language

Registration isn't just about listing tools – it's about establishing a communication protocol. Each tool declares its input schema using precise type definitions. This is like agreeing on the language you'll use to communicate. Will numbers be integers or strings? Are dates ISO-8601 or Unix timestamps? What fields are required versus optional?

This upfront agreement prevents miscommunication. The AI agent knows exactly how to format its requests, and MCIP knows exactly what to expect. It's a contract that both sides honor, ensuring smooth interaction every time.

Capability Negotiation

Not all AI agents are created equal. Some support complex parameter types. Others prefer simple structures. During registration, tools can adjust their capabilities based on the agent's declared features.

For instance, if an agent supports structured filters, search_product might expose advanced filtering options. If not, it falls back to simpler text-based filtering. This adaptive registration ensures every agent gets the richest experience it can handle without overwhelming simpler implementations.


Parameter Validation: The Guardian at the Gate

Zod - The Vigilant Validator

Every tool input passes through Zod validation before processing. Think of Zod as a very particular security guard who checks every detail of your ID before letting you into the building. Not just that you have an ID, but that it's the right type, not expired, has all required fields, and the photo actually looks like you.

When an AI agent calls search_product with a query, Zod checks: Is there a query string? Is it between 1 and 500 characters? Are the filters, if provided, properly structured? Is the maxPrice, if specified, a positive number? This validation happens in microseconds, but it prevents hours of debugging mysterious errors.

The beauty of Zod is that it's not just checking – it's also transforming. If an agent sends a price as a string "1500" instead of number 1500, Zod can coerce it to the right type. If optional fields are missing, Zod provides defaults. It's not just validation – it's normalization.

Descriptive Rejection

When validation fails, Zod doesn't just say "no." It explains exactly what went wrong and how to fix it. Instead of "Invalid request," you get "The 'maxPrice' field must be a positive number, received -100." Instead of "Missing parameter," you get "Required field 'query' was not provided."

These descriptive errors are like having a helpful teacher rather than a harsh judge. The AI agent learns what went wrong and can correct it immediately. This educational approach to errors reduces integration time and frustration dramatically.

Type Safety All the Way Down

Validation doesn't stop at the entry point. Throughout MCIP's processing pipeline, types are preserved and validated. The query that comes in as a string remains a string. The price that's validated as a number stays a number. This type consistency prevents the insidious bugs that come from type coercion and assumption.

It's like having a chain of custody for evidence in a court case. Every transformation is tracked, every type is guaranteed. By the time data reaches the business logic, it's pristine and trustworthy. No defensive programming needed – the types are the defense.


Response Formatting: Crafting the Perfect Reply

The Universal Structure

Every tool response follows the same structure. Success or failure. Data or error. Metadata about timing and sources. This consistency is like having all books in a library follow the same format – you always know where to find the table of contents, the index, the chapters.

{
  "success": true,
  "data": { ... },
  "metadata": {
    "timestamp": "...",
    "processingTime": 234,
    "sources": ["vendure", "shopify"]
  }
}

This predictable structure means AI agents can parse responses without special cases. They check success first, then process data or handle errors accordingly. The metadata provides transparency about what happened behind the scenes – how long it took, which sources contributed, any warnings or notes.

Normalized Data Models

Within the data field, every product looks the same regardless of source platform. A Shopify product and a WooCommerce product become identical in structure once they pass through MCIP. This normalization is like having a universal translator that makes everyone speak the same language.

Products always have: id, name, description, price, currency, availability. They might have: images, variants, categories, ratings. They never have: platform-specific quirks, inconsistent field names, nested mysteries. This predictability makes client code simple and robust.

Semantic Enrichment

Responses aren't just normalized – they're enriched. Each product includes a relevance score showing how well it matches the query. Categories are standardized across platforms. Prices include currency conversion notes if applicable. Availability includes estimated restock dates when known.

This enrichment transforms raw data into intelligent information. It's the difference between someone handing you a pile of parts versus a clearly labeled kit with instructions. The AI agent gets not just data, but context and intelligence.

Streaming for Large Results

When returning many products, MCIP can stream results progressively. Instead of waiting for all 100 products to process, the agent receives them in batches of 10. This creates a responsive experience where users see initial results immediately while more load in the background.

It's like a good waiter who brings out appetizers while the main course is being prepared. You're never left waiting with nothing, but you also get the complete meal eventually. This progressive enhancement keeps conversations flowing naturally.


Error Handling: Grace Under Pressure

The Error Hierarchy

Not all errors are equal. MCIP uses a hierarchical error system that distinguishes between severities and types. Client errors (bad requests) are different from server errors (our fault). Temporary failures (network timeout) are different from permanent ones (product doesn't exist).

Each error category has its own response strategy. Client errors return immediately with helpful correction instructions. Server errors trigger retries with exponential backoff. Temporary failures might return partial results with a note about what's missing. This nuanced approach ensures the best possible outcome for every situation.

Partial Success Philosophy

Here's something beautiful about MCIP's error handling: we believe in partial success. If you search across five platforms and one fails, you get results from four rather than a complete failure. If you request 10 products and 2 have errors, you get 8 products plus error details for the failures.

This philosophy acknowledges that in the real world, perfection is rare but good enough is often perfect. Users would rather see most results quickly than wait forever for complete results. It's like a GPS that shows you the route even if it can't find every side street – still useful, still valuable.

Error Recovery Strategies

When errors occur, MCIP doesn't just report them – it attempts recovery. Timeout? Try a faster cache. Rate limited? Queue and retry. Parsing error? Fall back to basic extraction. Each error type has recovery strategies that maximize the chance of eventual success.

These recovery strategies are invisible to the AI agent when they work. The agent makes a request, gets a response. Behind the scenes, MCIP might have retried three times, fallen back to cache, and aggregated partial results. But the agent just sees success. It's like having a really good assistant who handles problems without bothering you.

Educational Error Messages

When errors can't be recovered, the messages are educational, not just informational. Instead of "Authentication failed," you get "Authentication failed: The API key for Shopify appears to be expired. Please refresh it in the admin panel." Instead of "Timeout error," you get "The Vendure platform took longer than 1.5 seconds to respond. This might indicate high load. Try again or proceed with results from other platforms."

These educational errors turn problems into learning opportunities. They help developers understand not just what went wrong, but why it went wrong and how to prevent it in the future. It's the difference between a red X and a helpful teacher's note in the margin.


The Tool Orchestra in Action

A Symphony of Coordination

Watch what happens when a user says "Find me a good coffee maker and add it to my cart":

First movement: search_product springs into action, interpreting "good coffee maker" through RAG, understanding that "good" might mean well-reviewed, reasonably priced, from a known brand. It searches across platforms, aggregates results, scores relevance, and returns options.

Second movement: The AI agent analyzes results, perhaps asking follow-up questions about preferences. Budget? Capacity? Features? This natural conversation refines the selection.

Third movement: add_to_cart captures the chosen product, establishing a session if needed, storing the selection with full context about why it was chosen and what alternatives were considered.

Fourth movement: view_cart confirms the addition, showing the item with current pricing and availability, perhaps suggesting compatible items like coffee filters or descaling solution.

Each tool plays its part, but together they create a complete shopping experience. No tool tries to do everything. Each excels at its specific role. The coordination is invisible, the result is magical.

Context Preservation Across Tools

Here's something subtle but crucial: tools share context within a session. When search_product finds items, that search context is available to add_to_cart. When view_cart displays items, it knows what searches led to those selections. This shared context enables natural, flowing conversations.

It's like having a shopping assistant with perfect memory. They remember not just what you bought, but what you looked at, what you asked about, what you decided against. This context makes interactions feel human, not mechanical.

Performance Harmony

All five tools are designed to work within the same performance envelope. Each targets sub-500ms response times. This consistency means complex operations involving multiple tools still feel snappy. Search, add, view, update – each step is fast, so the complete journey feels instant.

This performance harmony requires careful orchestration. Tools share connection pools, cache layers, and processing pipelines. They're not five separate systems – they're five interfaces to one intelligent system. That's why they work so well together.


Beyond the Basics: Advanced Tool Patterns

Tool Composition

While each tool is powerful alone, they're designed for composition. AI agents can create complex workflows by combining tools intelligently. Search for products, add the top three to cart, view total price, remove the most expensive one – all in a single conversation flow.

This composability is like having LEGO blocks that always fit together perfectly. Each tool is a building block, but what you build is limited only by imagination. Some agents create price comparison workflows. Others build gift recommendation systems. The tools enable creativity.

Conditional Tool Chains

Smart agents create conditional chains based on responses. If search returns no results, broaden the query. If cart total exceeds budget, suggest removing items. If all items are from one platform, mention bulk discount possibility. These conditional chains create intelligent, adaptive experiences.

Parallel Tool Execution

Advanced agents can call multiple tools in parallel when appropriate. While searching for a laptop, simultaneously check if previous laptop searches are in the cart. While adding items, pre-fetch cart totals for immediate display. This parallelism creates remarkably responsive experiences.


The Future of MCP Tools

Expanding Vocabulary

The five tools we have today are just the beginning. Imagine wishlist management, price tracking, review aggregation, recommendation engines – all exposed as simple MCP tools. The vocabulary of AI commerce will expand, but the simplicity of interaction will remain.

Smarter Tools

Future tools will be even more intelligent. Predictive search that knows what you want before you finish typing. Cart optimization that suggests better product combinations. Automatic deal finding that applies discounts without asking. The tools will become not just functional, but genuinely helpful.

Cross-Platform Intelligence

As MCIP connects more platforms, tools will become smarter about platform differences. They'll know that Shopify has better search but WooCommerce has better prices. They'll automatically route requests to the best platform for each need. This routing intelligence will be invisible but powerful.