import { adcpError } from '@adcp/client';
server.tool("get_products", schema, async ({ query }) => {
if (!products.length) {
return adcpError('PRODUCT_NOT_FOUND', {
message: 'No products match query',
field: 'query',
suggestion: 'Try a broader search term',
});
}
return { content: [...], structuredContent: { products } };
});
Build an L3-compliant MCP tool error response with all three transport layers:
structuredContent.adcp_error— programmatic extraction (L3)content[0].text— JSON text fallback (L2)isError: true— MCP error signalRecovery is auto-populated from the standard error code table when not provided.