Skip to main content
Glama

search-audits

Search and filter Descope project audit logs by login IDs, actions, tenants, methods, or geographic locations to monitor authentication events and security activities.

Instructions

Search Descope project audit logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loginIdsNoFilter by specific login IDs
actionsNoFilter by specific action types
excludedActionsNoActions to exclude from results
tenantsNoFilter by specific tenant IDs
noTenantsNoIf true, only show events without tenants
methodsNoFilter by authentication methods
geosNoFilter by geographic locations
hoursBackNoHours to look back (max 720 hours / 30 days)
limitNoNumber of audit logs to fetch (max 10)

Implementation Reference

  • The asynchronous handler function that executes the 'search-audits' tool. It constructs a time range based on hoursBack, calls descope.management.audit.search with filters, limits results, and returns formatted JSON text or error message.
    async ({ loginIds, actions, excludedActions, tenants, noTenants, methods, geos, hoursBack, limit }) => {
        try {
            const now = Date.now();
            const from = now - (hoursBack * 60 * 60 * 1000);
            const audits = await descope.management.audit.search({
                from,
                to: now,
                loginIds,
                actions,
                excludedActions,
                tenants,
                noTenants,
                methods,
                geos,
            });
    
            // Limit the number of audits to the specified limit
            const auditResponse = audits.data;
            const limitedAudits = auditResponse ? auditResponse.slice(0, limit) : [];
    
            return {
                content: [
                    {
                        type: "text",
                        text: `Audit logs for the last ${hoursBack} hours:\n\n${JSON.stringify(limitedAudits, null, 2)}`,
                    },
                ],
            };
        } catch (error) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Error fetching audit logs: ${error}`,
                    },
                ],
            };
        }
    },
  • Zod schema defining the input parameters and validation for the 'search-audits' tool, including optional filters, time range, and result limit.
        // Optional filters
        loginIds: z.array(z.string()).optional()
            .describe("Filter by specific login IDs"),
        actions: z.array(z.string()).optional()
            .describe("Filter by specific action types"),
        excludedActions: z.array(z.string()).optional()
            .describe("Actions to exclude from results"),
        tenants: z.array(z.string()).optional()
            .describe("Filter by specific tenant IDs"),
        noTenants: z.boolean().optional()
            .describe("If true, only show events without tenants"),
        methods: z.array(z.string()).optional()
            .describe("Filter by authentication methods"),
        geos: z.array(z.string()).optional()
            .describe("Filter by geographic locations"),
        // Time range (defaults to last 24 hours)
        hoursBack: z.number().min(1).max(24 * 30).default(24)
            .describe("Hours to look back (max 720 hours / 30 days)"),
        // Limit (defaults to 5)
        limit: z.number().min(1).max(10).default(5)
            .describe("Number of audit logs to fetch (max 10)"),
    },
  • src/descope.ts:33-98 (registration)
    Registration of the 'search-audits' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
        "search-audits",
        "Search Descope project audit logs",
        {
            // Optional filters
            loginIds: z.array(z.string()).optional()
                .describe("Filter by specific login IDs"),
            actions: z.array(z.string()).optional()
                .describe("Filter by specific action types"),
            excludedActions: z.array(z.string()).optional()
                .describe("Actions to exclude from results"),
            tenants: z.array(z.string()).optional()
                .describe("Filter by specific tenant IDs"),
            noTenants: z.boolean().optional()
                .describe("If true, only show events without tenants"),
            methods: z.array(z.string()).optional()
                .describe("Filter by authentication methods"),
            geos: z.array(z.string()).optional()
                .describe("Filter by geographic locations"),
            // Time range (defaults to last 24 hours)
            hoursBack: z.number().min(1).max(24 * 30).default(24)
                .describe("Hours to look back (max 720 hours / 30 days)"),
            // Limit (defaults to 5)
            limit: z.number().min(1).max(10).default(5)
                .describe("Number of audit logs to fetch (max 10)"),
        },
        async ({ loginIds, actions, excludedActions, tenants, noTenants, methods, geos, hoursBack, limit }) => {
            try {
                const now = Date.now();
                const from = now - (hoursBack * 60 * 60 * 1000);
                const audits = await descope.management.audit.search({
                    from,
                    to: now,
                    loginIds,
                    actions,
                    excludedActions,
                    tenants,
                    noTenants,
                    methods,
                    geos,
                });
    
                // Limit the number of audits to the specified limit
                const auditResponse = audits.data;
                const limitedAudits = auditResponse ? auditResponse.slice(0, limit) : [];
    
                return {
                    content: [
                        {
                            type: "text",
                            text: `Audit logs for the last ${hoursBack} hours:\n\n${JSON.stringify(limitedAudits, null, 2)}`,
                        },
                    ],
                };
            } catch (error) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Error fetching audit logs: ${error}`,
                        },
                    ],
                };
            }
        },
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the action ('Search') without revealing any behavioral traits such as whether this is a read-only operation, if it requires specific permissions, rate limits, pagination behavior, or what the output looks like. For a search tool with 9 parameters, this lack of context is a significant gap.

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 any wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every part of the description earns its place by conveying essential information.

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 (9 parameters, no output schema, no annotations), the description is incomplete. It doesn't address behavioral aspects like safety, permissions, or output format, which are critical for a search tool with multiple filtering options. The schema covers parameters well, but the description fails to provide necessary context beyond the basic action.

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, with each parameter clearly documented in the schema itself (e.g., 'Filter by specific login IDs', 'Hours to look back'). The description adds no additional meaning beyond the schema, so it meets the baseline of 3 where the schema does the heavy lifting without compensating for any gaps.

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 'Search Descope project audit logs' clearly states the verb ('Search') and resource ('Descope project audit logs'), making the purpose immediately understandable. It distinguishes this tool from its siblings (create-user, invite-user, search-users) by focusing on audit logs rather than user management. However, it doesn't specify what aspects of audit logs are searchable or the scope of the search, keeping it from a perfect score.

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 or in what context it's appropriate. It doesn't mention prerequisites, limitations, or relationships with sibling tools like search-users, leaving the agent to infer usage based solely on the tool name and parameters.

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