Skip to main content
Glama
lithtrix

lithtrix-mcp

Official

lithtrix_search

Search the web and obtain credibility-scored results. Each result includes a score from 0 to 1 indicating source authority, helping you quickly assess reliability.

Instructions

Search the web via Lithtrix and get credibility-scored results. Returns structured JSON with title, URL, snippet, source domain, and credibility_score (0–1) for each result. Higher credibility_score = more authoritative source (.gov=1.0, .edu=0.9, news=0.8, .org=0.7, other=0.5). Requires LITHTRIX_API_KEY environment variable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesThe search query (1–500 characters)
num_resultsNoNumber of results to return (1–20, default 10)

Implementation Reference

  • The async handler function that executes the lithtrix_search tool logic: validates API key, calls GET /v1/search on the Lithtrix API, and returns structured JSON results with error handling.
      async ({ q, num_results = 10 }) => {
        const apiKey = process.env.LITHTRIX_API_KEY;
        if (!apiKey) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  error: "LITHTRIX_API_KEY environment variable is not set. " +
                    "Register at https://lithtrix.ai to get an API key.",
                }),
              },
            ],
            isError: true,
          };
        }
    
        const url = new URL("/v1/search", LITHTRIX_API_URL);
        url.searchParams.set("q", q);
        url.searchParams.set("num_results", String(num_results));
    
        let response;
        try {
          response = await fetch(url.toString(), {
            headers: {
              Authorization: `Bearer ${apiKey}`,
              "Content-Type": "application/json",
            },
          });
        } catch (err) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  error: `Network error contacting Lithtrix API: ${err.message}`,
                }),
              },
            ],
            isError: true,
          };
        }
    
        const body = await response.json();
    
        if (!response.ok) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  error: body.message ?? `Lithtrix API error (HTTP ${response.status})`,
                  error_code: body.error_code ?? "UNKNOWN",
                }),
              },
            ],
            isError: true,
          };
        }
    
        // Return the full structured response so agents can use results + usage info
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(body, null, 2),
            },
          ],
        };
      }
    );
  • Input schema for lithtrix_search using Zod: requires 'q' (string, 1-500 chars) and optional 'num_results' (int 1-20, default 10).
    {
      q: z
        .string()
        .min(1)
        .max(500)
        .describe("The search query (1–500 characters)"),
      num_results: z
        .number()
        .int()
        .min(1)
        .max(20)
        .default(10)
        .optional()
        .describe("Number of results to return (1–20, default 10)"),
    },
  • tools/search.js:12-105 (registration)
    The registerSearchTool function that registers the tool with the MCP server via server.tool('lithtrix_search', ...).
    export function registerSearchTool(server) {
      server.tool(
        "lithtrix_search",
        "Search the web via Lithtrix and get credibility-scored results. " +
          "Returns structured JSON with title, URL, snippet, source domain, and credibility_score (0–1) " +
          "for each result. Higher credibility_score = more authoritative source (.gov=1.0, .edu=0.9, " +
          "news=0.8, .org=0.7, other=0.5). Requires LITHTRIX_API_KEY environment variable.",
        {
          q: z
            .string()
            .min(1)
            .max(500)
            .describe("The search query (1–500 characters)"),
          num_results: z
            .number()
            .int()
            .min(1)
            .max(20)
            .default(10)
            .optional()
            .describe("Number of results to return (1–20, default 10)"),
        },
        async ({ q, num_results = 10 }) => {
          const apiKey = process.env.LITHTRIX_API_KEY;
          if (!apiKey) {
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify({
                    error: "LITHTRIX_API_KEY environment variable is not set. " +
                      "Register at https://lithtrix.ai to get an API key.",
                  }),
                },
              ],
              isError: true,
            };
          }
    
          const url = new URL("/v1/search", LITHTRIX_API_URL);
          url.searchParams.set("q", q);
          url.searchParams.set("num_results", String(num_results));
    
          let response;
          try {
            response = await fetch(url.toString(), {
              headers: {
                Authorization: `Bearer ${apiKey}`,
                "Content-Type": "application/json",
              },
            });
          } catch (err) {
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify({
                    error: `Network error contacting Lithtrix API: ${err.message}`,
                  }),
                },
              ],
              isError: true,
            };
          }
    
          const body = await response.json();
    
          if (!response.ok) {
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify({
                    error: body.message ?? `Lithtrix API error (HTTP ${response.status})`,
                    error_code: body.error_code ?? "UNKNOWN",
                  }),
                },
              ],
              isError: true,
            };
          }
    
          // Return the full structured response so agents can use results + usage info
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(body, null, 2),
              },
            ],
          };
        }
      );
    }
  • index.js:31-45 (registration)
    Import of registerSearchTool from './tools/search.js' and call to register the tool: registerSearchTool(server).
    import { registerSearchTool } from "./tools/search.js";
    import { registerRegisterTool } from "./tools/register.js";
    import { registerMemoryTools } from "./tools/memory.js";
    import { registerBlobTools } from "./tools/blobs.js";
    import { registerParseTools } from "./tools/parse.js";
    import { registerFeedbackTool } from "./tools/feedback.js";
    import { registerBrowseTool } from "./tools/browse.js";
    import { registerCommonsTool } from "./tools/commons.js";
    
    const server = new McpServer({
      name: "lithtrix",
      version: "0.9.0",
    });
    
    registerSearchTool(server);
Behavior4/5

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

Given no annotations, the description provides good behavioral disclosure: explains the structured output fields (title, URL, snippet, source domain, credibility_score), the scoring scheme (0–1 based on source authority), and the API key requirement. It does not cover rate limits or error handling, but the key behaviors are transparent.

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 three concise sentences, each adding unique value. It is front-loaded with the purpose, then details output structure and prerequisites. No redundant or irrelevant information.

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?

For a search tool with no annotations or output schema, the description sufficiently covers purpose, input, output format, and authentication. It lacks information on error responses or result count limits beyond schema max, but covers core usage well.

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?

Input schema covers both parameters with descriptions (q: query, num_results: result count). However, the description adds no additional semantic detail about parameters beyond the schema, such as how to format queries or handle special characters. With 100% schema coverage, baseline is 3.

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?

Description clearly states the tool searches the web via Lithtrix and returns credibility-scored results. It specifies the action (search), resource (web), and unique output feature (credibility scores), distinguishing it from sibling tools like lithtrix_browse (page browsing) and lithtrix_blob_search (blob content).

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?

Description implies usage for web searches but does not explicitly state when to use this tool versus alternatives like lithtrix_blob_search or lithtrix_browse. It mentions a prerequisite (API key) but lacks context about scenarios where this tool is preferred.

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