experiment-list
Retrieve a paginated list of A/B test experiments with search functionality to filter by name, description, or experiment key, enabling streamlined data access and analysis.
Instructions
Fetches a paginated list of A/B test experiments with search functionality.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageNumber | No | ||
| pageSize | No | ||
| searchKeyword | No | name, description, or experimentKey of an experiment. |
Implementation Reference
- src/index.ts:23-41 (handler)The inline async handler function for the 'experiment-list' tool. Constructs query string with pagination and search parameters, fetches data from Hackle API using WebClient.get, JSON.stringifies the result, and returns it as tool content.async ({ pageNumber = 1, pageSize = 100, searchKeyword = '' }) => { const qs = stringify( { pageNumber, pageSize, searchKeyword, }, { addQueryPrefix: true }, ); return { content: [ { type: 'text', text: JSON.stringify(await WebClient.get(`/api/v1/experiments${qs}`)), }, ], }; },
- src/index.ts:18-22 (schema)Zod input schema defining optional parameters: pageNumber (default 1), pageSize (default 100), searchKeyword.{ pageNumber: z.number().optional().default(1), pageSize: z.number().optional().default(100), searchKeyword: z.string().optional().describe('name, description, or experimentKey of an experiment.'), },
- src/index.ts:15-42 (registration)MCP server.tool registration for 'experiment-list' tool, specifying name, description, input schema, and inline handler function.server.tool( 'experiment-list', 'Fetches a paginated list of A/B test experiments with search functionality.', { pageNumber: z.number().optional().default(1), pageSize: z.number().optional().default(100), searchKeyword: z.string().optional().describe('name, description, or experimentKey of an experiment.'), }, async ({ pageNumber = 1, pageSize = 100, searchKeyword = '' }) => { const qs = stringify( { pageNumber, pageSize, searchKeyword, }, { addQueryPrefix: true }, ); return { content: [ { type: 'text', text: JSON.stringify(await WebClient.get(`/api/v1/experiments${qs}`)), }, ], }; }, );