search_users
Find users by name, email, department, or position in the JSON database server to manage user information and access.
Instructions
Kullanıcıları ad, email, departman veya pozisyona göre arar
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Arama terimi |
Implementation Reference
- src/index.js:691-705 (handler)Handler for the 'search_users' tool. Extracts query from arguments, calls searchUsers helper on database users, strips passwords from results, and returns JSON-formatted list.case 'search_users': { const { query } = args; const results = searchUsers(db.users, query); const resultsWithoutPasswords = results.map(user => { const { password, ...userWithoutPassword } = user; return userWithoutPassword; }); return { content: [{ type: 'text', text: JSON.stringify(resultsWithoutPasswords, null, 2) }] }; }
- src/index.js:244-254 (registration)Registration of the 'search_users' tool in the ListToolsRequestSchema handler, including name, description, and inputSchema.{ name: 'search_users', description: 'Kullanıcıları ad, email, departman veya pozisyona göre arar', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Arama terimi' } }, required: ['query'] } },
- src/index.js:247-252 (schema)Input schema for 'search_users' tool: requires a 'query' string parameter.inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Arama terimi' } }, required: ['query']
- src/database.js:46-54 (helper)Helper function searchUsers that filters users array by lowercase query matching name, email, department, or position.export function searchUsers(users, query) { const searchTerm = query.toLowerCase(); return users.filter(user => user.name.toLowerCase().includes(searchTerm) || user.email.toLowerCase().includes(searchTerm) || user.department.toLowerCase().includes(searchTerm) || user.position.toLowerCase().includes(searchTerm) ); }