jsonplaceholder_users
Retrieve test user data from JSONPlaceholder for development and testing purposes, with configurable limits up to 10 records.
Instructions
Get test users data from JSONPlaceholder
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of users to return (1-10) |
Implementation Reference
- The main handler function that executes the tool logic: fetches users from JSONPlaceholder API using the client instance and returns a standardized ToolOutput.execute: async (args: any) => { try { const users = await client.getUsers(args.limit || 5); return { success: true, data: { source: 'JSONPlaceholder API', type: 'users', results: users, count: users.length, timestamp: Date.now(), apiUsed: true } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get test users' }; } }
- JSON Schema definition for tool inputs, specifying an optional 'limit' parameter between 1-10 with default 5.inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of users to return (1-10)', default: 5, minimum: 1, maximum: 10 } }, required: [] },
- src/tools/testing/jsonplaceholder-tools.ts:233-273 (registration)Tool registration call to registry.registerTool() that defines and registers the jsonplaceholder_users tool including its handler and schema.registry.registerTool({ name: 'jsonplaceholder_users', description: 'Get test users data from JSONPlaceholder', category: 'testing', source: 'jsonplaceholder.typicode.com', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of users to return (1-10)', default: 5, minimum: 1, maximum: 10 } }, required: [] }, execute: async (args: any) => { try { const users = await client.getUsers(args.limit || 5); return { success: true, data: { source: 'JSONPlaceholder API', type: 'users', results: users, count: users.length, timestamp: Date.now(), apiUsed: true } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get test users' }; } } });
- Supporting helper method in JSONPlaceholderAPIClient class that makes the API request to /users endpoint and slices results by optional limit.async getUsers(limit?: number) { const users = await this.makeRequest('/users'); return limit ? users.slice(0, limit) : users; }
- src/utils/input-validator.ts:270-272 (schema)Additional Zod schema for input validation of jsonplaceholder_users parameters in the global input-validator utility.'jsonplaceholder_users': z.object({ limit: z.number().int().min(1).max(10).optional().default(5) }),