Skip to main content
Glama

search-users

Search for users in a Descope project by text, email, phone, status, roles, or other filters to manage user access and permissions.

Instructions

Search for users in Descope project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNoText to search for in user fields
emailsNoFilter by specific email addresses
phonesNoFilter by specific phone numbers
statusesNoFilter by user statuses ('enabled', 'disabled', or 'invited')
rolesNoFilter users by role names
tenantIdsNoFilter users by specific tenant IDs
ssoAppIdsNoFilter users by SSO application IDs
loginIdsNoFilter by specific login IDs
withTestUserNoInclude test users in results
testUsersOnlyNoReturn only test users
pageNoPage number for pagination
limitNoNumber of users per page (max 100)

Implementation Reference

  • The handler function executes the user search using Descope's management.user.search API, handles the response or error, and formats it as MCP content.
    async ({ text, emails, phones, statuses, roles, tenantIds, ssoAppIds, loginIds, withTestUser, testUsersOnly, page, limit }) => { try { const users = await descope.management.user.search({ text, emails, phones, statuses, roles, tenantIds, ssoAppIds, loginIds, withTestUser, testUsersOnly, page, limit, }); return { content: [ { type: "text", text: `Found users:\n\n${JSON.stringify(users.data, null, 2)}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error searching users: ${error}`, }, ], }; } },
  • Zod schema defining the input parameters for the search-users tool, including filters like text, emails, statuses, pagination, etc.
    { // Search parameters text: z.string().optional() .describe("Text to search for in user fields"), emails: z.array(z.string()).optional() .describe("Filter by specific email addresses"), phones: z.array(z.string()).optional() .describe("Filter by specific phone numbers"), statuses: z.array(z.enum(['enabled', 'disabled', 'invited'])).optional() .describe("Filter by user statuses ('enabled', 'disabled', or 'invited')"), roles: z.array(z.string()).optional() .describe("Filter users by role names"), tenantIds: z.array(z.string()).optional() .describe("Filter users by specific tenant IDs"), ssoAppIds: z.array(z.string()).optional() .describe("Filter users by SSO application IDs"), loginIds: z.array(z.string()).optional() .describe("Filter by specific login IDs"), withTestUser: z.boolean().optional() .describe("Include test users in results"), testUsersOnly: z.boolean().optional() .describe("Return only test users"), page: z.number().min(0).optional() .describe("Page number for pagination"), limit: z.number().min(1).max(100).default(10) .describe("Number of users per page (max 100)"), },
  • src/descope.ts:101-167 (registration)
    The server.tool call that registers the 'search-users' tool with its name, description, input schema, and handler function.
    server.tool( "search-users", "Search for users in Descope project", { // Search parameters text: z.string().optional() .describe("Text to search for in user fields"), emails: z.array(z.string()).optional() .describe("Filter by specific email addresses"), phones: z.array(z.string()).optional() .describe("Filter by specific phone numbers"), statuses: z.array(z.enum(['enabled', 'disabled', 'invited'])).optional() .describe("Filter by user statuses ('enabled', 'disabled', or 'invited')"), roles: z.array(z.string()).optional() .describe("Filter users by role names"), tenantIds: z.array(z.string()).optional() .describe("Filter users by specific tenant IDs"), ssoAppIds: z.array(z.string()).optional() .describe("Filter users by SSO application IDs"), loginIds: z.array(z.string()).optional() .describe("Filter by specific login IDs"), withTestUser: z.boolean().optional() .describe("Include test users in results"), testUsersOnly: z.boolean().optional() .describe("Return only test users"), page: z.number().min(0).optional() .describe("Page number for pagination"), limit: z.number().min(1).max(100).default(10) .describe("Number of users per page (max 100)"), }, async ({ text, emails, phones, statuses, roles, tenantIds, ssoAppIds, loginIds, withTestUser, testUsersOnly, page, limit }) => { try { const users = await descope.management.user.search({ text, emails, phones, statuses, roles, tenantIds, ssoAppIds, loginIds, withTestUser, testUsersOnly, page, limit, }); return { content: [ { type: "text", text: `Found users:\n\n${JSON.stringify(users.data, null, 2)}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error searching users: ${error}`, }, ], }; } }, );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/descope-sample-apps/descope-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server