MCIP
Client

Response Handling

Handling Successful Responses

When your AI agent calls a tool, the response includes rich data. It is crucial to parse this information to provide the best possible experience.

  • Search Responses: A response from the search_product tool includes "not just products but rich metadata" about the search process. This metadata allows your agent to be more transparent with the user.
  • Cart Responses: When implementing cart operations (like add_to_cart or update_cart_item), "each operation returns the complete updated cart". This ensures your agent always has the current cart state to share with the user.
Response MetadataDescription
Relevance ScoresTells you how well each product matches the query's intent.
Processing TimeIncludes breakdowns showing where time was spent during the search.
Search Method IndicatorReveals whether results came from semantic search or a fallback to keywords.

Handling Errors and Fallbacks

Errors are not just failures; they are "opportunities to provide helpful guidance" and maintain user confidence. MCIP provides detailed error information to help your agent respond appropriately.

Error TypeHow to Handle
Rate LimitingThe error will include retry-after information. Your agent can use this to intelligently schedule a retry instead of failing, perhaps telling the user, "I'm processing a lot of searches right now. Let me try again in a few seconds."
Validation ErrorsThe error provides specific information about which field was wrong and how to fix it (e.g., a filter value is out of range). Your agent can use this to guide the user toward a valid input.
Timeouts / AvailabilityMCIP may trigger internal fallbacks (e.g., using keyword search if semantic search fails). The response will indicate when a fallback was used, allowing your agent to set user expectations.

Performance: Streaming Responses

To make the system feel faster, your agent should handle streaming responses. If MCIP is searching multiple platforms, your agent can "show results from fast platforms immediately" while slower ones are still processing. This progressive enhancement keeps users engaged.