Skip to main content
Glama

list_sessions

List active sessions with pagination for admin operations. Requires master authentication to filter by wallet ID and set page limits.

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 MCP tool handler for list_sessions. Registers a tool called 'list_sessions' that accepts optional wallet_id, limit, and offset parameters. Makes a GET request to /v1/sessions via the API client and returns the paginated result.
    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);
        },
      );
    }
  • SDK type definition for ListSessionsParams with optional walletId, limit, and offset fields.
    export interface ListSessionsParams {
      walletId?: string;
      limit?: number;
      offset?: number;
    }
  • SDK type definition for PaginatedSessionList containing data array of SessionListItem, total, limit, and offset.
    export interface PaginatedSessionList {
      data: SessionListItem[];
      total: number;
      limit: number;
      offset: number;
    }
  • SDK type definition for SessionListItem with fields like id, walletId, walletName, wallets, status, renewalCount, expiresAt, source, etc.
    export interface SessionListItem {
      id: string;
      walletId: string;
      walletName: string | null;
      wallets: Array<{ id: string; name: string }>;
      status: string;
      renewalCount: number;
      maxRenewals: number;
      expiresAt: number;
      absoluteExpiresAt: number;
      createdAt: number;
      lastRenewedAt: number | null;
      source: 'api' | 'mcp';
    }
  • Import of registerListSessions from list-sessions.ts (line 35) and registration call at line 90 in createMcpServer.
    import { registerListSessions } from './tools/list-sessions.js';
    import { registerGetTokens } from './tools/get-tokens.js';
    import { registerListIncomingTransactions } from './tools/list-incoming-transactions.js';
    import { registerGetIncomingSummary } from './tools/get-incoming-summary.js';
    import { registerGetDefiPositions } from './tools/get-defi-positions.js';
    import { registerGetHealthFactor } from './tools/get-health-factor.js';
    import { registerSimulateTransaction } from './tools/simulate-transaction.js';
    import { registerErc8004GetAgentInfo } from './tools/erc8004-get-agent-info.js';
    import { registerErc8004GetReputation } from './tools/erc8004-get-reputation.js';
    import { registerErc8004GetValidationStatus } from './tools/erc8004-get-validation-status.js';
    import { registerGetProviderStatus } from './tools/get-provider-status.js';
    import { registerSignMessage } from './tools/sign-message.js';
    import { registerErc8128SignRequest } from './tools/erc8128-sign-request.js';
    import { registerErc8128VerifySignature } from './tools/erc8128-verify-signature.js';
    import { registerListNfts } from './tools/list-nfts.js';
    import { registerGetNftMetadata } from './tools/get-nft-metadata.js';
    import { registerTransferNft } from './tools/transfer-nft.js';
    import { registerBuildUserop } from './tools/build-userop.js';
    import { registerSignUserop } from './tools/sign-userop.js';
    import { registerHyperliquidTools } from './tools/hyperliquid.js';
    import { registerPolymarketTools } from './tools/polymarket.js';
    import { registerListOffchainActions } from './tools/list-offchain-actions.js';
    import { registerListCredentials } from './tools/list-credentials.js';
    import { registerGetRpcProxyUrl } from './tools/get-rpc-proxy-url.js';
    import { registerResolveAsset } from './tools/resolve-asset.js';
    
    // Resource registrations (Task 2)
    import { registerWalletBalance } from './resources/wallet-balance.js';
    import { registerWalletAddress } from './resources/wallet-address.js';
    import { registerSystemStatus } from './resources/system-status.js';
    import { registerSkillResources } from './resources/skills.js';
    
    export interface WalletContext {
      walletName?: string; // e.g., 'trading-bot'
    }
    
    /**
     * Prefix description with wallet name for multi-wallet identification (MCPS-03).
     */
    export function withWalletPrefix(description: string, walletName?: string): string {
      return walletName ? `[${walletName}] ${description}` : description;
    }
    
    export function createMcpServer(apiClient: ApiClient, walletContext?: WalletContext): McpServer {
      const serverName = walletContext?.walletName
        ? `waiaas-${walletContext.walletName}`
        : 'waiaas-wallet';
    
      const server = new McpServer({
        name: serverName,
        version: PKG_VERSION,
      });
    
      // Register 42 tools
      registerConnectInfo(server, apiClient);
      registerListSessions(server, apiClient);
      registerGetPolicies(server, apiClient, walletContext);
      registerGetTokens(server, apiClient, walletContext);
      registerSendToken(server, apiClient, walletContext);
      registerGetBalance(server, apiClient, walletContext);
      registerGetAddress(server, apiClient, walletContext);
      registerGetAssets(server, apiClient, walletContext);
      registerListTransactions(server, apiClient, walletContext);
      registerGetTransaction(server, apiClient, walletContext);
      registerGetNonce(server, apiClient, walletContext);
      registerCallContract(server, apiClient, walletContext);
      registerApproveToken(server, apiClient, walletContext);
      registerSendBatch(server, apiClient, walletContext);
      registerGetWalletInfo(server, apiClient, walletContext);
      registerEncodeCalldata(server, apiClient, walletContext);
      registerSignTransaction(server, apiClient, walletContext);
      registerX402Fetch(server, apiClient, walletContext);
      registerWcConnect(server, apiClient, walletContext);
      registerWcStatus(server, apiClient, walletContext);
      registerWcDisconnect(server, apiClient, walletContext);
      registerListIncomingTransactions(server, apiClient, walletContext);
      registerGetIncomingSummary(server, apiClient, walletContext);
      registerGetDefiPositions(server, apiClient, walletContext);
      registerGetHealthFactor(server, apiClient, walletContext);
      registerSimulateTransaction(server, apiClient, walletContext);
      registerErc8004GetAgentInfo(server, apiClient, walletContext);
      registerErc8004GetReputation(server, apiClient, walletContext);
      registerErc8004GetValidationStatus(server, apiClient, walletContext);
      registerGetProviderStatus(server, apiClient, walletContext);
      registerSignMessage(server, apiClient, walletContext);
      registerErc8128SignRequest(server, apiClient, walletContext);
      registerErc8128VerifySignature(server, apiClient, walletContext);
      registerListNfts(server, apiClient, walletContext);
      registerGetNftMetadata(server, apiClient, walletContext);
      registerTransferNft(server, apiClient, walletContext);
      registerBuildUserop(server, apiClient, walletContext);
      registerSignUserop(server, apiClient, walletContext);
      registerHyperliquidTools(server, apiClient, walletContext);
      registerPolymarketTools(server, apiClient, walletContext);
      registerListOffchainActions(server, apiClient, walletContext);
      registerListCredentials(server, apiClient, walletContext);
      registerGetRpcProxyUrl(server, apiClient, walletContext);
      registerResolveAsset(server, apiClient);
    
      // Register 4 resource groups (3 static + 1 template)
      registerWalletBalance(server, apiClient, walletContext);
      registerWalletAddress(server, apiClient, walletContext);
      registerSystemStatus(server, apiClient, walletContext);
      registerSkillResources(server, apiClient, walletContext);
    
      return server;
    }
Behavior4/5

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

With no annotations, the description carries full burden. It discloses authentication requirement and pagination behavior (limit/offset). It does not mention side effects, data freshness, or scope of sessions, but for a read-only list operation, the disclosure is adequate.

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?

Two sentences with no redundancy. Every word adds value: verb, resource, pagination, admin requirement, auth info. Highly efficient.

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

Completeness4/5

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

For a simple list operation with 3 parameters and no output schema, the description covers purpose, auth, and pagination. It could mention if the list is sorted or what 'active' means, but overall it is sufficiently informative given the tool's simplicity.

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?

Input schema has 100% description coverage for all parameters (wallet_id, limit, offset). The description adds no additional meaning beyond mentioning 'pagination', which is already covered by schema descriptions. Baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb 'List', the resource 'active sessions', and key features 'pagination' and 'admin operation'. It distinguishes from siblings by specifying admin scope and pagination, which is not evident in other tool names.

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

Usage Guidelines4/5

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

The description explicitly states 'Admin operation requiring master auth', providing clear usage context. However, it lacks guidance on when not to use or alternatives, nor does it elaborate on pagination best practices. Still, the auth requirement is a strong cue.

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

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