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}`,
                        },
                    ],
                };
            }
        },
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic action without disclosing behavioral traits. It doesn't mention authentication needs, rate limits, pagination behavior (implied by parameters but not described), error handling, or what fields are searched. For a search tool with 12 parameters, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with zero wasted content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (12 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain the search scope (which user fields are searched), result format, pagination behavior, or error cases. For a search tool with rich filtering options, more context is needed to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, thoroughly documenting all 12 parameters with their types, constraints, and purposes. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline of 3 without compensating or detracting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Search for users') and the resource ('in Descope project'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from its sibling 'search-audits' beyond the resource type, missing explicit distinction in scope or purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create-user' or 'invite-user', nor does it mention any prerequisites or contextual constraints. It lacks explicit when/when-not instructions or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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