Skip to main content
Glama

Real-time fact verification against web knowledge. Reduces hallucinations and improves content integrity through statement verification.

jina_grounding_enhance

Verify content accuracy by checking facts against web knowledge to reduce hallucinations and improve content integrity.

Instructions

Real-time fact verification against web knowledge. Reduces hallucinations and improves content integrity through statement verification.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesContent

Implementation Reference

  • Core implementation of the enhancement logic: validates API key, calls Jina AI grounding API with the content as statement, processes response to return factuality score, verdict, reasoning, references, and metadata.
    async enhance_content(content: string): Promise<EnhancementResult> {
    	const api_key = validate_api_key(
    		config.enhancement.jina_grounding.api_key,
    		this.name,
    	);
    
    	const ground_request = async () => {
    		try {
    			const data = await http_json<JinaGroundingResponse>(
    				this.name,
    				'https://g.jina.ai',
    				{
    					method: 'POST',
    					headers: {
    						'Content-Type': 'application/json',
    						Authorization: `Bearer ${api_key}`,
    					},
    					body: JSON.stringify({ statement: content }),
    					signal: AbortSignal.timeout(
    						config.enhancement.jina_grounding.timeout,
    					),
    				},
    			);
    
    			if (!data?.data) {
    				throw new ProviderError(
    					ErrorType.API_ERROR,
    					'Unexpected response: missing data from Jina Grounding',
    					this.name,
    				);
    			}
    
    			// Format references into a readable string
    			const references_text = data.data.references
    				.map(
    					(ref) =>
    						`${ref.is_supportive ? '✓' : '✗'} ${ref.key_quote} (${
    							ref.url
    						})`,
    				)
    				.join('\n\n');
    
    			return {
    				original_content: content,
    				enhanced_content: `Factuality Score: ${
    					data.data.factuality
    				}\nVerdict: ${
    					data.data.result ? 'True' : 'False'
    				}\n\nReasoning: ${
    					data.data.reason
    				}\n\nReferences:\n${references_text}`,
    				enhancements: [
    					{
    						type: 'fact_verification',
    						description:
    							'Verified factual accuracy against real-time web knowledge',
    					},
    				],
    				sources: data.data.references.map((ref) => ({
    					title: ref.key_quote,
    					url: ref.url,
    				})),
    				source_provider: this.name,
    				meta: {
    					factuality: data.data.factuality,
    					result: data.data.result,
    					token_usage: data.data.usage.tokens,
    				},
    			};
    		} catch (error) {
    			handle_provider_error(error, this.name, 'ground content');
    		}
    	};
    
    	return retry_with_backoff(ground_request);
    }
  • Dynamically registers the MCP tool 'jina_grounding_enhance' (constructed as `${provider.name}_enhance`) for all enhancement providers, including schema validation for 'content' input and wrapper handler that calls provider.enhance_content().
    // Register enhancement providers
    this.enhancement_providers.forEach((provider) => {
    	server.tool(
    		{
    			name: `${provider.name}_enhance`,
    			description: provider.description,
    			schema: v.object({
    				content: v.pipe(v.string(), v.description('Content')),
    			}),
    		},
    		async ({ content }) => {
    			try {
    				const result = await provider.enhance_content(content);
    				const safe_result = handle_large_result(
    					result,
    					provider.name,
    				);
    				return {
    					content: [
    						{
    							type: 'text' as const,
    							text: JSON.stringify(safe_result, null, 2),
    						},
    					],
    				};
    			} catch (error) {
    				const error_response = create_error_response(
    					error as Error,
    				);
    				return {
    					content: [
    						{
    							type: 'text' as const,
    							text: error_response.error,
    						},
    					],
    					isError: true,
    				};
    			}
    		},
    	);
    });
  • Conditionally registers the JinaGroundingProvider instance (with name 'jina_grounding') if API key is valid, enabling the 'jina_grounding_enhance' tool.
    	is_api_key_valid(
    		config.enhancement.jina_grounding.api_key,
    		'jina_grounding',
    	)
    ) {
    	register_enhancement_provider(new JinaGroundingProvider());
    }
  • TypeScript interface defining the expected response structure from Jina Grounding API, used for type-safe parsing in the handler.
    interface JinaGroundingResponse {
    	code: number;
    	status: number;
    	data: {
    		factuality: number;
    		result: boolean;
    		reason: string;
    		references: Array<{
    			url: string;
    			key_quote: string;
    			is_supportive: boolean;
    		}>;
    		usage: {
    			tokens: number;
    		};
    	};
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'real-time fact verification' and 'reduces hallucinations', which implies read-only behavior and reliability benefits, but doesn't address critical aspects like rate limits, authentication needs, error handling, or what constitutes 'verification' (e.g., confidence scores, sources). This leaves significant gaps for a tool interacting with web knowledge.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise, consisting of two sentences that directly state the tool's purpose and benefit. It's front-loaded with key information and has no wasted words, though it could be slightly more structured (e.g., separating purpose from outcome).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of fact verification against web knowledge, no annotations, no output schema, and a single parameter, the description is incomplete. It lacks details on behavioral traits (e.g., how verification works, response format), usage context, and doesn't compensate for the absence of structured data, making it inadequate for informed tool selection.

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 schema description coverage is 100%, with the single parameter 'content' described as 'Content'. The description adds no additional meaning about this parameter beyond what the schema provides (e.g., what type of content, format, or length is expected). Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't need to heavily.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tautological: description restates name/title.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any specific contexts, prerequisites, or exclusions, nor does it reference sibling tools. The phrase 'statement verification' hints at usage but lacks explicit when/when-not instructions.

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/spences10/mcp-omnisearch'

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