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
| Name | Required | Description | Default |
|---|---|---|---|
| statement | Yes | ||
| deepdive | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"deepdive": {
"default": false,
"type": "boolean"
},
"statement": {
"type": "string"
}
},
"required": [
"statement"
],
"type": "object"
}
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()); }
- schemas.ts:68-71 (schema)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) }
- index.ts:151-155 (handler)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) }] }; }
- evals.ts:25-32 (helper)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); } };