Skip to main content
Glama
lithtrix

lithtrix-mcp

Official

lithtrix_blob_download

Retrieve blob bytes via blob ID. Returns JSON with base64-encoded content and content type.

Instructions

Download blob bytes (GET /v1/blobs/{blob_id}). Returns JSON with content_base64 and content_type. Requires LITHTRIX_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blob_idYesContent-addressed blob id (b_ + 16 hex chars)

Implementation Reference

  • tools/blobs.js:194-217 (registration)
    Registration of the lithtrix_blob_download tool on the MCP server using server.tool(). Calls blobDownloadResult() helper on success.
    server.tool(
      "lithtrix_blob_download",
      "Download blob bytes (GET /v1/blobs/{blob_id}). Returns JSON with content_base64 and content_type. " +
        "Requires LITHTRIX_API_KEY.",
      { blob_id: blobIdSchema },
      async ({ blob_id }) => {
        const apiKey = process.env.LITHTRIX_API_KEY;
        if (!apiKey) return missingApiKeyResponse();
    
        const path = `/v1/blobs/${encodeURIComponent(blob_id)}`;
        let response;
        try {
          response = await fetch(new URL(path, LITHTRIX_API_URL), {
            headers: {
              Authorization: `Bearer ${apiKey}`,
              Accept: "*/*",
            },
          });
        } catch (err) {
          return networkErrorResponse(err);
        }
        return blobDownloadResult(response);
      }
    );
  • Input schema: blob_id (string, length 19, regex /^b_[0-9a-f]{16}$/) validated via blobIdSchema.
    { blob_id: blobIdSchema },
  • Handler function: checks LITHTRIX_API_KEY, GETs /v1/blobs/{blob_id}, returns blobDownloadResult(response).
    async ({ blob_id }) => {
      const apiKey = process.env.LITHTRIX_API_KEY;
      if (!apiKey) return missingApiKeyResponse();
    
      const path = `/v1/blobs/${encodeURIComponent(blob_id)}`;
      let response;
      try {
        response = await fetch(new URL(path, LITHTRIX_API_URL), {
          headers: {
            Authorization: `Bearer ${apiKey}`,
            Accept: "*/*",
          },
        });
      } catch (err) {
        return networkErrorResponse(err);
      }
      return blobDownloadResult(response);
    }
  • Helper function blobDownloadResult() that reads the response as arrayBuffer, encodes to base64, extracts content-type, and returns JSON with content_base64, content_type, size_bytes.
    async function blobDownloadResult(response) {
      if (!response.ok) {
        let body;
        try {
          body = await response.json();
        } catch {
          body = {};
        }
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: body.message ?? `Lithtrix API error (HTTP ${response.status})`,
                error_code: body.error_code ?? "UNKNOWN",
                status: body.status,
              }),
            },
          ],
          isError: true,
        };
      }
    
      const buf = await response.arrayBuffer();
      const b64 = Buffer.from(buf).toString("base64");
      const ct = response.headers.get("content-type") || "application/octet-stream";
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                content_base64: b64,
                content_type: ct,
                size_bytes: buf.byteLength,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • blobIdSchema — Zod schema validating blob_id format (length 19, prefix b_ + 16 hex chars).
    const blobIdSchema = z
      .string()
      .length(19)
      .regex(/^b_[0-9a-f]{16}$/)
      .describe("Content-addressed blob id (b_ + 16 hex chars)");
Behavior3/5

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

With no annotations, the description partially bears the burden. It discloses the return format (JSON with content_base64 and content_type) and auth requirement, but does not mention safety (read-only), error handling, or rate limits.

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 extremely concise with two sentences. It is front-loaded with the action and contains no unnecessary words.

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?

Given the simplicity of the tool (one parameter, no output schema), the description is nearly complete: it covers purpose, endpoint, return format, and auth. It could mention error scenarios but is adequate.

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?

The input schema already provides a description for blob_id ('Content-addressed blob id (b_ + 16 hex chars)'). The description does not add additional meaning beyond what the schema offers.

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 'Download blob bytes' and provides the HTTP endpoint and return format. It effectively distinguishes from sibling tools like lithtrix_blob_upload and lithtrix_blob_delete.

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 mentions 'Requires LITHTRIX_API_KEY' as a prerequisite but lacks explicit guidance on when to use this tool versus alternatives like lithtrix_blob_signed_url or other blob operations.

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/lithtrix/lithtrix-mcp'

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