jsonplaceholder_users
Retrieve test user data from JSONPlaceholder using Open Search MCP, with options to limit results for precise querying and testing purposes.
Instructions
Get test users data from JSONPlaceholder
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of users to return (1-10) |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 5,
"description": "Maximum number of users to return (1-10)",
"maximum": 10,
"minimum": 1,
"type": "number"
}
},
"required": [],
"type": "object"
}
Implementation Reference
- The execute handler for the jsonplaceholder_users tool. It fetches users using the JSONPlaceholderAPIClient.getUsers method with optional limit 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' }; } }
- Input schema definition for the jsonplaceholder_users tool, specifying optional limit parameter.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)Registration of the jsonplaceholder_users tool in the ToolRegistry within registerJSONPlaceholderTools function.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' }; } } });
- Helper method in JSONPlaceholderAPIClient class that fetches users from /users endpoint and applies limit.async getUsers(limit?: number) { const users = await this.makeRequest('/users'); return limit ? users.slice(0, limit) : users; }
- src/utils/input-validator.ts:270-271 (schema)Zod schema for input validation of jsonplaceholder_users tool in the global input validator.'jsonplaceholder_users': z.object({ limit: z.number().int().min(1).max(10).optional().default(5)