Skip to main content
Glama
JCF0

CG Alpha MCP

by JCF0

elfa_reload_env

Reload environment configuration files to update settings for crypto market analysis tools that combine sentiment data with technical indicators.

Instructions

Reload .env files from common locations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that reloads environment variables using loadEnvMulti, rebuilds authentication and base URL from env vars, and returns the current configuration status.
    "elfa_reload_env": async () => {
      loadEnvMulti();
      ELFA_AUTH = buildAuthFromEnv();
      ELFA_BASE = (process.env.ELFA_BASE || ELFA_BASE).replace(/\/+$/,"");
      return { content: textContent({
        ok: true,
        base: ELFA_BASE,
        loaded: ENV_INFO.loaded,
        from: ENV_INFO.from,
        vars: ENV_INFO.vars,
        auth: { headerName: ELFA_AUTH.headerName || "", scheme: ELFA_AUTH.scheme || "", key: maskKey(ELFA_AUTH.key) }
      }) };
    },
  • mcp-server.js:276-280 (registration)
    Tool registration entry in the tools array, providing name, description, empty input schema (no parameters), and annotations.
    { name:"elfa_reload_env",
      description:"Reload .env files from common locations.",
      inputSchema:{ type:"object", properties:{} },
      annotations:{ title:"ELFA: Reload .env", readOnlyHint:false, openWorldHint:false }
    },
  • Key helper function called by the handler to load .env files from multiple possible locations (cwd, __dirname, parent dirs), updates ENV_INFO, and logs the result.
    function loadEnvMulti() {
      ENV_INFO = { loaded: false, from: [], vars: [] };
      const __filename = fileURLToPath(import.meta.url);
      const __dirname  = path.dirname(__filename);
      const candidates = [
        path.join(process.cwd(), ".env"),
        path.join(__dirname, ".env"),
        path.join(path.dirname(__dirname), ".env"),       // one level up
        path.join(path.dirname(path.dirname(__dirname)), ".env") // two up
      ];
      const seen = new Set();
      for (let i = 0; i < candidates.length; i++) {
        const p = candidates[i];
        if (seen.has(p)) continue; seen.add(p);
        if (fs.existsSync(p)) {
          dotenv.config({ path: p, override: false });
          ENV_INFO.loaded = true;
          ENV_INFO.from.push(p);
        }
      }
      // Capture which ELFA_* we actually have
      const known = ["ELFA_API_KEY","ELFA_HEADER","ELFA_AUTH_TYPE","ELFA_BASE"];
      for (let i = 0; i < known.length; i++) {
        if (process.env[known[i]] !== undefined) ENV_INFO.vars.push(known[i]);
      }
      console.info(`[dotenv] loaded=${ENV_INFO.loaded} from=${JSON.stringify(ENV_INFO.from)} vars=${JSON.stringify(ENV_INFO.vars)}`);
    }
  • Helper function to build ELFA authentication object from environment variables, preferring x-elfa-api-key header.
    function buildAuthFromEnv() {
      const envKey = process.env.ELFA_API_KEY || "";
      let header = (process.env.ELFA_HEADER || "x-elfa-api-key").toLowerCase(); // default to x-elfa-api-key
      if (header !== "x-elfa-api-key" && header !== "authorization") {
        header = "x-elfa-api-key";
      }
      if (header === "authorization") {
        return { headerName: "Authorization", scheme: "Bearer", key: envKey };
      }
      return { headerName: "x-elfa-api-key", scheme: "", key: envKey };
    }
Behavior3/5

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

Annotations indicate readOnlyHint=false (implying mutation) and openWorldHint=false (suggesting deterministic behavior). The description adds that it reloads from 'common locations,' which provides useful context beyond annotations. However, it doesn't specify effects (e.g., overwriting current env vars) or error conditions, leaving behavioral gaps.

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 with zero waste. It's front-loaded with the core action and resource, making it highly concise and well-structured for quick understanding.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema) and annotations covering safety aspects, the description is adequate but minimal. It lacks details on outcomes (e.g., success indicators) or integration with sibling tools, making it only moderately complete for a mutation tool.

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?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description doesn't need to explain parameters, and it appropriately avoids redundant information, maintaining a high score for this dimension.

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 clearly states the action ('Reload') and target resource ('.env files from common locations'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from potential siblings that might also manipulate .env files, though no such siblings exist in the provided list.

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. It doesn't mention prerequisites (e.g., when .env files exist), exclusions, or related tools like 'elfa_set_auth' or 'elfa_set_base' that might interact with environment settings.

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/JCF0/cg-alpha-mcp'

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