Skip to main content
Glama
joeblockchain

Jina AI MCP Server

fact_check

Verify statements for accuracy using Jina AI's grounding engine to identify factual claims and provide supporting evidence.

Instructions

Fact-check a statement using Jina AI's grounding engine

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statementYes
deepdiveNo

Implementation Reference

  • index.ts:89-108 (handler)
    The groundStatement function executes the fact_check tool logic by querying Jina AI's grounding API with the provided statement and optional deepdive flag, parsing the response with GroundingResponseSchema.
    async function groundStatement(params: z.infer<typeof GroundingSchema>) {
      const headers: Record<string, string> = {
        'Authorization': `Bearer ${JINA_API_KEY}`,
        'Accept': 'application/json'
      };
    
      const statementQuery = encodeURIComponent(params.statement);
      const url = `https://g.jina.ai/${statementQuery}${params.deepdive ? '?deepdive=true' : ''}`;
    
      const response = await fetch(url, {
        method: 'GET',
        headers,
      });
    
      if (!response.ok) {
        throw new Error(`Jina AI Grounding API error: ${response.statusText}`);
      }
    
      return GroundingResponseSchema.parse(await response.json());
    }
  • Zod schema defining the input parameters for the fact_check tool: a required 'statement' string and optional 'deepdive' boolean.
    export const GroundingSchema = z.object({
      statement: z.string(),
      deepdive: z.boolean().optional().default(false)
    });
  • index.ts:123-127 (registration)
    Registers the fact_check tool in the ListTools response, specifying its name, description, and input schema.
    {
      name: "fact_check",
      description: "Fact-check a statement using Jina AI's grounding engine",
      inputSchema: zodToJsonSchema(GroundingSchema)
    }
  • Switch case in CallToolRequestSchema handler that parses arguments for fact_check, calls groundStatement, and formats the response as text content.
    case "fact_check": {
      const args = GroundingSchema.parse(request.params.arguments);
      const result = await groundStatement(args);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Evaluation function (fact_checkEval) for testing the fact_check tool using mcp-evals framework.
    const fact_checkEval: EvalFunction = {
        name: 'fact_check Tool Evaluation',
        description: 'Evaluates the correctness of the fact-checking tool',
        run: async () => {
            const result = await grade(openai("gpt-4o"), "Is it true that the Great Wall of China is visible from space?");
            return JSON.parse(result);
        }
    };
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/joeblockchain/mcp-jina-ai'

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