Skip to main content
Glama
DeanWard

HAL (HTTP API Layer)

List Available Secrets

list-secrets

Retrieve names of secret keys for use with {secrets.key} syntax without exposing actual values.

Instructions

Get a list of available secret keys that can be used with {secrets.key} syntax. Only shows the key names, never the actual secret values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:695-794 (registration)
    Registration of the 'list-secrets' tool via server.registerTool() with name 'list-secrets', title 'List Available Secrets', and description about listing secret keys without exposing values.
    server.registerTool(
      "list-secrets",
      {
        title: "List Available Secrets",
        description: "Get a list of available secret keys that can be used with {secrets.key} syntax. Only shows the key names, never the actual secret values.",
        inputSchema: {}
      },
      async () => {
        try {
          const secretKeys = Object.keys(secrets);
          
          if (secretKeys.length === 0) {
            return {
              content: [{
                type: "text" as const,
                text: "No secrets are currently configured. To add secrets, set environment variables with the HAL_SECRET_ prefix.\n\nExample:\n  HAL_SECRET_API_KEY=your_api_key\n  HAL_SECRET_TOKEN=your_token\n\nThen use them in requests like: {secrets.api_key} or {secrets.token}\n\nFor namespaced secrets with URL restrictions:\n  HAL_SECRET_MICROSOFT_API_KEY=your_api_key\n  HAL_ALLOW_MICROSOFT=\"https://azure.microsoft.com/*\"\n  Usage: {secrets.microsoft.api_key}"
              }]
            };
          }
          
          let response = `Available secrets (${secretKeys.length} total):\n\n`;
          
          // Group secrets by namespace
          const namespacedSecrets: Record<string, string[]> = {};
          const unrestrictedSecrets: string[] = [];
          
          for (const [key, secretInfo] of Object.entries(secrets)) {
            if (secretInfo.namespace) {
              const namespaceTemplate = secretInfo.namespace.toLowerCase().replace(/-/g, '.');
              if (!namespacedSecrets[namespaceTemplate]) {
                namespacedSecrets[namespaceTemplate] = [];
              }
              namespacedSecrets[namespaceTemplate].push(key);
            } else {
              unrestrictedSecrets.push(key);
            }
          }
          
          // Show unrestricted secrets first
          if (unrestrictedSecrets.length > 0) {
            response += "**Unrestricted Secrets** (can be used with any URL):\n";
            unrestrictedSecrets.forEach((key, index) => {
              response += `${index + 1}. {secrets.${key}}\n`;
            });
            response += "\n";
          }
          
          // Show namespaced secrets with their restrictions
          for (const [namespace, keys] of Object.entries(namespacedSecrets)) {
            const firstKey = keys[0];
            const secretInfo = secrets[firstKey];
            
            response += `**Namespace: ${namespace}**\n`;
            if (secretInfo.allowedUrls && secretInfo.allowedUrls.length > 0) {
              response += `Restricted to URLs: ${secretInfo.allowedUrls.join(', ')}\n`;
            } else {
              response += "No URL restrictions (can be used with any URL)\n";
            }
            response += "Secrets:\n";
            
            keys.forEach((key, index) => {
              response += `${index + 1}. {secrets.${key}}\n`;
            });
            response += "\n";
          }
          
          response += "**Usage examples:**\n";
          const exampleKey = secretKeys[0] || 'token';
          response += `- URL: "https://api.example.com/data?token={secrets.${exampleKey}}"\n`;
          response += `- Header: {"Authorization": "Bearer {secrets.${exampleKey}}"}\n`;
          response += `- Body: {"username": "{secrets.${secretKeys.find(k => k.includes('user')) || 'username'}}"}\n\n`;
          
          response += "**Security Notes:**\n";
          response += "- Only the key names are shown here. The actual secret values are never exposed to the AI.\n";
          response += "- Secrets are substituted securely at request time.\n";
          
          const restrictedCount = Object.values(secrets).filter(s => s.allowedUrls).length;
                  if (restrictedCount > 0) {
              response += `- ${restrictedCount} secrets have URL restrictions for enhanced security.\n`;
              response += "- If a secret is restricted, it will only work with URLs matching its allowed patterns.\n";
            }
          
          return {
            content: [{
              type: "text" as const,
              text: response
            }]
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : 'Unknown error';
          return {
            content: [{
              type: "text" as const,
              text: `Error listing secrets: ${redactSecretsFromText(errorMessage)}`
            }],
            isError: true
          };
        }
      }
    );
  • The handler function for 'list-secrets' tool. It lists all available secret keys grouped by namespace, shows URL restrictions, usage examples, and security notes. Never exposes actual secret values.
    async () => {
      try {
        const secretKeys = Object.keys(secrets);
        
        if (secretKeys.length === 0) {
          return {
            content: [{
              type: "text" as const,
              text: "No secrets are currently configured. To add secrets, set environment variables with the HAL_SECRET_ prefix.\n\nExample:\n  HAL_SECRET_API_KEY=your_api_key\n  HAL_SECRET_TOKEN=your_token\n\nThen use them in requests like: {secrets.api_key} or {secrets.token}\n\nFor namespaced secrets with URL restrictions:\n  HAL_SECRET_MICROSOFT_API_KEY=your_api_key\n  HAL_ALLOW_MICROSOFT=\"https://azure.microsoft.com/*\"\n  Usage: {secrets.microsoft.api_key}"
            }]
          };
        }
        
        let response = `Available secrets (${secretKeys.length} total):\n\n`;
        
        // Group secrets by namespace
        const namespacedSecrets: Record<string, string[]> = {};
        const unrestrictedSecrets: string[] = [];
        
        for (const [key, secretInfo] of Object.entries(secrets)) {
          if (secretInfo.namespace) {
            const namespaceTemplate = secretInfo.namespace.toLowerCase().replace(/-/g, '.');
            if (!namespacedSecrets[namespaceTemplate]) {
              namespacedSecrets[namespaceTemplate] = [];
            }
            namespacedSecrets[namespaceTemplate].push(key);
          } else {
            unrestrictedSecrets.push(key);
          }
        }
        
        // Show unrestricted secrets first
        if (unrestrictedSecrets.length > 0) {
          response += "**Unrestricted Secrets** (can be used with any URL):\n";
          unrestrictedSecrets.forEach((key, index) => {
            response += `${index + 1}. {secrets.${key}}\n`;
          });
          response += "\n";
        }
        
        // Show namespaced secrets with their restrictions
        for (const [namespace, keys] of Object.entries(namespacedSecrets)) {
          const firstKey = keys[0];
          const secretInfo = secrets[firstKey];
          
          response += `**Namespace: ${namespace}**\n`;
          if (secretInfo.allowedUrls && secretInfo.allowedUrls.length > 0) {
            response += `Restricted to URLs: ${secretInfo.allowedUrls.join(', ')}\n`;
          } else {
            response += "No URL restrictions (can be used with any URL)\n";
          }
          response += "Secrets:\n";
          
          keys.forEach((key, index) => {
            response += `${index + 1}. {secrets.${key}}\n`;
          });
          response += "\n";
        }
        
        response += "**Usage examples:**\n";
        const exampleKey = secretKeys[0] || 'token';
        response += `- URL: "https://api.example.com/data?token={secrets.${exampleKey}}"\n`;
        response += `- Header: {"Authorization": "Bearer {secrets.${exampleKey}}"}\n`;
        response += `- Body: {"username": "{secrets.${secretKeys.find(k => k.includes('user')) || 'username'}}"}\n\n`;
        
        response += "**Security Notes:**\n";
        response += "- Only the key names are shown here. The actual secret values are never exposed to the AI.\n";
        response += "- Secrets are substituted securely at request time.\n";
        
        const restrictedCount = Object.values(secrets).filter(s => s.allowedUrls).length;
                if (restrictedCount > 0) {
            response += `- ${restrictedCount} secrets have URL restrictions for enhanced security.\n`;
            response += "- If a secret is restricted, it will only work with URLs matching its allowed patterns.\n";
          }
        
        return {
          content: [{
            type: "text" as const,
            text: response
          }]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return {
          content: [{
            type: "text" as const,
            text: `Error listing secrets: ${redactSecretsFromText(errorMessage)}`
          }],
          isError: true
        };
      }
    }
  • Input schema for 'list-secrets' tool - an empty object meaning no parameters required.
    "list-secrets",
    {
      title: "List Available Secrets",
      description: "Get a list of available secret keys that can be used with {secrets.key} syntax. Only shows the key names, never the actual secret values.",
      inputSchema: {}
Behavior4/5

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

With no annotations provided, the description carries the burden of behavioral disclosure. It explicitly states that only key names are shown and never actual secret values, which is a critical safety trait. Additional details like authentication or rate limits are absent, but the primary behavioral constraint is well communicated.

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, information-dense sentence with no wasted words. It front-loads the action and resource, then adds a critical safety caveat.

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

Completeness5/5

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

For a tool with no parameters and no output schema, the description fully covers what the tool does and what it returns (key names) and explicitly what it does not return (values). It provides sufficient context for correct usage.

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

Parameters4/5

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

The tool has zero parameters and schema coverage is 100% trivially. The description does not need to add parameter meaning. According to guidelines, 0 parameters earns a baseline of 4.

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 uses specific verb 'Get a list' and clearly identifies the resource 'available secret keys'. It distinguishes itself from sibling HTTP tools by focusing on secrets. The additional detail about not showing actual values further clarifies purpose.

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

Usage Guidelines3/5

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

The description implies usage when a list of secret keys is needed, but does not explicitly state when not to use or provide alternatives. Among sibling tools, it is unique, so no competing tool is mentioned, but the description lacks explicit guidance.

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/DeanWard/HAL'

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