Skip to main content
Glama

list_sessions

Retrieve and manage active sessions with pagination controls for admin oversight. Filter by wallet ID and control result display using limit and offset parameters.

Instructions

List active sessions with pagination. Admin operation requiring master auth.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wallet_idNoFilter by wallet ID
limitNoMax items to return (default: 50)
offsetNoNumber of items to skip (default: 0)

Implementation Reference

  • The handler function that executes the `list_sessions` tool logic by calling the API client with provided query parameters.
      async (args) => {
        const params = new URLSearchParams();
        if (args.wallet_id) params.set('walletId', args.wallet_id);
        if (args.limit !== undefined) params.set('limit', String(args.limit));
        if (args.offset !== undefined) params.set('offset', String(args.offset));
        const qs = params.toString();
        const result = await apiClient.get('/v1/sessions' + (qs ? '?' + qs : ''));
        return toToolResult(result);
      },
    );
  • The registration function that defines the `list_sessions` tool on the McpServer instance.
    export function registerListSessions(server: McpServer, apiClient: ApiClient): void {
      server.tool(
        'list_sessions',
        'List active sessions with pagination. Admin operation requiring master auth.',
        {
          wallet_id: z.string().optional().describe('Filter by wallet ID'),
          limit: z.number().int().min(1).max(200).optional().describe('Max items to return (default: 50)'),
          offset: z.number().int().min(0).optional().describe('Number of items to skip (default: 0)'),
        },
        async (args) => {
          const params = new URLSearchParams();
          if (args.wallet_id) params.set('walletId', args.wallet_id);
          if (args.limit !== undefined) params.set('limit', String(args.limit));
          if (args.offset !== undefined) params.set('offset', String(args.offset));
          const qs = params.toString();
          const result = await apiClient.get('/v1/sessions' + (qs ? '?' + qs : ''));
          return toToolResult(result);
        },
      );
    }

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/minhoyoo-iotrust/WAIaaS'

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