search_items
Retrieve and filter specific items from the PlayFab catalog using OData queries. Specify search terms, pagination, and sorting parameters for precise results.
Instructions
PlayFab search items
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| continuationToken | No | An opaque token used to retrieve the next page of items, if any are available. | |
| count | Yes | Number of items to retrieve. This value is optional. Maximum page size is 50. Default value is 10. | |
| filter | No | An OData filter used to refine the search query (For example: "type eq 'ugc'"). More info about Filter Complexity limits can be found here: https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/search#limits | |
| orderBy | No | An OData orderBy used to order the results of the search query. For example: "rating/average asc" | |
| search | No | The text to search for. |
Implementation Reference
- The core handler function for the 'search_items' tool. Validates input parameters using utility functions, constructs the request with custom tags, calls PlayFabEconomyAPI.SearchItems through admin API wrapper, and returns formatted response with items array and optional continuation token.export const SearchItems: PlayFabHandler<SearchItemsParams, SearchItemsResult> = async (params) => { // Validate input parameters const validatedParams: SearchItemsValidatedParams = { Count: validatePaginationCount(params.Count, 'Count', 10, 50), }; // Optional parameters const continuationToken = validateString(params.ContinuationToken, 'ContinuationToken'); if (continuationToken) validatedParams.ContinuationToken = continuationToken; const filter = validateString(params.Filter, 'Filter', { maxLength: 2048 }); if (filter) validatedParams.Filter = filter; const orderBy = validateString(params.OrderBy, 'OrderBy', { maxLength: 2048 }); if (orderBy) validatedParams.OrderBy = orderBy; const search = validateString(params.Search, 'Search', { maxLength: 2048 }); if (search) validatedParams.Search = search; // Make API call with validated parameters const request = addCustomTags(validatedParams); const result = await callAdminAPI( PlayFabEconomyAPI.SearchItems, request, 'SearchItems' ); return { success: true, items: result.Items || [], continuationToken: result.ContinuationToken }; }
- Defines the MCP Tool specification for 'search_items', including detailed description, input schema with optional properties for pagination, filtering, sorting, and search term.export const SEARCH_ITEMS_TOOL: Tool = { name: "search_items", description: "Searches for items in the PlayFab catalog (Economy v2). Use this when you need to find items by name, type, or other properties. " + "Common uses: Finding all weapons, searching for items containing 'sword', filtering by price range. " + "Returns item details including ID, name, description, and prices. " + "Supports pagination for large result sets. Use the returned items' IDs with inventory management tools.", inputSchema: { type: "object", properties: { Count: { type: "number", description: "Number of items to retrieve per page. Maximum is 50. Default is 10." }, ContinuationToken: { type: "string", description: "Token for retrieving the next page of results. Use null or omit for the first request." }, Filter: { type: "string", description: "OData filter string to refine the search. Example: 'type eq \'ugc\''" }, OrderBy: { type: "string", description: "OData orderBy string to sort results. Example: 'rating/average asc'" }, Search: { type: "string", description: "Text to search for in the catalog. Example: 'sword'" } }, required: [], }, }
- src/server.ts:39-39 (registration)Registers the SearchItems handler function from catalog handlers module to the MCP router for the 'search_items' tool name.'search_items': catalogHandlers.SearchItems as any,
- src/server.ts:92-92 (registration)Registers the SEARCH_ITEMS_TOOL in the list of available tools returned by ListToolsRequestSchema handler.catalogTools.SEARCH_ITEMS_TOOL,
- src/handlers/index.ts:22-22 (registration)Lazy registration of the SearchItems handler in the central toolHandlers map for dynamic import."search_items": () => import('./catalog/search').then(m => m.SearchItems),