Skip to main content
Glama

tunnel_read

Retrieve a temporary tunneled secret by ID for secure access, with automatic deletion after reaching maximum read limits.

Instructions

Read an ephemeral tunneled secret by ID. May self-destruct if max-reads is reached.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesTunnel ID

Implementation Reference

  • The core implementation of the tunnelRead function which retrieves an ephemeral secret by its ID, handles expiration, increments access counters, and enforces auto-destruction logic.
    export function tunnelRead(id: string): string | null {
      const entry = tunnelStore.get(id);
      if (!entry) return null;
    
      if (entry.expiresAt && Date.now() >= entry.expiresAt) {
        tunnelStore.delete(id);
        return null;
      }
    
      entry.accessCount++;
    
      if (entry.maxReads && entry.accessCount >= entry.maxReads) {
        const value = entry.value;
        tunnelStore.delete(id);
        return value;
      }
    
      return entry.value;
    }
  • Registration of the "tunnel_read" tool in the MCP server, providing the schema and binding it to the tunnelRead handler.
      "tunnel_read",
      "Read an ephemeral tunneled secret by ID. May self-destruct if max-reads is reached.",
      {
        id: z.string().describe("Tunnel ID"),
      },
      async (params) => {
        const value = tunnelRead(params.id);
        if (value === null) {
          return text(`Tunnel "${params.id}" not found or expired`, true);
        }
        return text(value);
      },
    );

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/I4cTime/quantum_ring'

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