Skip to main content
Glama
moliver28

anythingllm-mcp

by moliver28

generate_api_key

Generate a new admin API key to authenticate and secure API access to your AnythingLLM platform.

Instructions

Generate a new API key (admin)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:67-67 (registration)
    The tool 'system_generate_api_key' is registered with the ListToolsRequestSchema handler, providing its name and description. The actual tool name used internally is 'system_generate_api_key'.
    { name: "system_generate_api_key", description: "Generate API key", inputSchema: { type: "object", properties: {}, required: [] } },
  • The apiRequest helper function makes HTTP requests to the AnythingLLM backend. It handles constructing the URL, adding auth headers, and parsing JSON responses.
    function apiRequest(path: string, method = "GET", body?: any, extraHeaders = {}): Promise<any> {
      return new Promise((resolve, reject) => {
        const baseUrl = new URL(ANYTHING_LLM_BASE);
        const fullUrl = new URL(path, baseUrl);
        const options: any = {
          hostname: fullUrl.hostname,
          port: fullUrl.port || (fullUrl.protocol === "https:" ? 443 : 80),
          path: fullUrl.pathname + fullUrl.search,
          method,
          headers: Object.assign({
            "Authorization": "Bearer " + ANYTHING_LLM_API_KEY,
            "Content-Type": "application/json",
            "Accept": "application/json",
          }, extraHeaders),
        };
    
        const lib = fullUrl.protocol === "https:" ? https : http;
        const req = lib.request(options, (res: any) => {
          let data = "";
          res.on("data", (chunk: string) => { data += chunk; });
          res.on("end", () => {
            try {
              resolve(data ? JSON.parse(data) : {});
            } catch {
              resolve({ raw: data });
            }
          });
        });
        req.on("error", reject);
        if (body) req.write(JSON.stringify(body));
        req.end();
      });
    }
  • The tool handler for 'system_generate_api_key' calls apiRequest('/system/generate-api-key', 'POST'), making a POST request to /api/v1/system/generate-api-key on the AnythingLLM backend. No additional input arguments are required.
    else if (name === "system_generate_api_key") { result = await apiRequest("/system/generate-api-key", "POST"); }
Behavior2/5

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

No annotations provided, so description must cover behavioral traits. It only states the action but does not disclose side effects (e.g., invalidates old keys), authentication requirements, or rate limits. Minimal information about the tool's behavior.

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?

Single sentence, front-loaded with verb and resource, no extraneous words. Ideal conciseness for a simple tool.

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 has no parameters and no output schema, the description is minimal but adequate for a straightforward action. However, it lacks details on expected output or behavioral context that would make it fully self-contained.

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?

With zero parameters and schema coverage at 100%, baseline is 3. The description adds no parameter-specific information beyond what the empty schema already conveys.

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 action 'Generate' and the resource 'API key', and indicates admin scope. It distinguishes from sibling tools like chat or check_token, which have different purposes.

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?

No guidelines on when to use this tool vs alternatives. With siblings like check_token and list_workspaces, the agent needs context on when generating an API key is appropriate, which is missing.

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/moliver28/anythingllm-mcp'

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