Appearance
Customize User and WooCommerce Tool Responses
User and WooCommerce read tools include pagination details in list responses and support filters for adding site-specific fields to user, customer, and order rows.
Pagination
The wp_list_users, wp_wc_list_customers, and wp_wc_list_orders tools return total, total_pages, page, and per_page beside the items. Use total_pages and page to determine whether another page is available, and use per_page to see how many items each page contains.
When the REST response includes pagination headers, the tools use them to calculate total and total_pages. If those headers are unavailable, the tools use the returned item count and calculate the page count from that count.
Row filters
| Filter | Tools |
|---|---|
easy_mcp_ai_user_row | wp_get_user, wp_list_users |
easy_mcp_ai_wc_customer_row | wp_wc_get_customer, wp_wc_list_customers |
easy_mcp_ai_wc_order_row | wp_wc_get_order, wp_wc_list_orders |
Each filter callback receives three arguments:
- The row the tool is preparing to return.
- The authorized REST source item for that row.
- Context with
tool(the tool name) andmode(listorsingle).
Return an array containing only the additional fields you want to include. These filters are additive: they cannot change or remove existing tool keys. User responses also reserve capabilities, extra_capabilities, cap_key, spam, and deleted, even when a particular response does not include those keys. Non-array callback results are ignored. The callback inputs are JSON-decoded copies, not mutable references to the original tool response.
For example, forward a crm_id field that is already present in the authorized user REST response:
php
add_filter( 'easy_mcp_ai_user_row', function ( $row, $source, $context ) {
if ( isset( $source['crm_id'] ) ) {
$row['crm_id'] = $source['crm_id'];
}
return $row;
}, 10, 3 );These filters do not register REST fields or grant access to protected data. Only expose fields that the caller is authorized to receive.