Skip to main content
Glama
spences10

MCP JinaAI Search Server

search

Search the web to retrieve clean, LLM-friendly content using Jina.ai Reader, returning top results with URLs and processed text for efficient information extraction.

Instructions

Search the web and get clean, LLM-friendly content using Jina.ai Reader. Returns top 5 results with URLs and clean content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
formatNoResponse format (json or text)text
no_cacheNoBypass cache for fresh results
token_budgetNoMaximum number of tokens for this request
browser_localeNoBrowser locale for rendering content
streamNoEnable stream mode for large pages
gather_linksNoGather all links at the end of the response
gather_imagesNoGather all images at the end of the response
image_captionNoCaption images in the content
enable_iframeNoExtract content from iframes
enable_shadow_domNoExtract content from shadow DOM
resolve_redirectsNoFollow redirect chains to final URL

Implementation Reference

  • Handler for CallToolRequestSchema that checks if the tool is 'search' and executes the Jina.ai search API call with parameters, handling response and errors.
    this.server.setRequestHandler(
    	CallToolRequestSchema,
    	async (request) => {
    		if (request.params.name !== 'search') {
    			throw new McpError(
    				ErrorCode.MethodNotFound,
    				`Unknown tool: ${request.params.name}`,
    			);
    		}
    
    		const arguments_record = request.params.arguments as {
    			query: string;
    			format?: 'json' | 'text';
    			no_cache?: boolean;
    			token_budget?: number;
    			browser_locale?: string;
    			stream?: boolean;
    			gather_links?: boolean;
    			gather_images?: boolean;
    			image_caption?: boolean;
    			enable_iframe?: boolean;
    			enable_shadow_dom?: boolean;
    			resolve_redirects?: boolean;
    		};
    		const {
    			query,
    			format = 'text',
    			no_cache = false,
    			token_budget,
    			browser_locale,
    			stream = false,
    			gather_links = false,
    			gather_images = false,
    			image_caption = false,
    			enable_iframe = false,
    			enable_shadow_dom = false,
    			resolve_redirects = true,
    		} = arguments_record;
    		const search_url = `https://s.jina.ai/${encodeURIComponent(
    			query,
    		)}`;
    
    		const headers: Record<string, string> = {
    			Authorization: `Bearer ${API_KEY}`,
    			Accept:
    				format === 'json' ? 'application/json' : 'text/plain',
    		};
    
    		if (no_cache) {
    			headers['X-Bypass-Cache'] = 'true';
    		}
    		if (token_budget) {
    			headers['X-Token-Budget'] = token_budget.toString();
    		}
    		if (browser_locale) {
    			headers['X-Browser-Locale'] = browser_locale;
    		}
    		if (stream) {
    			headers['X-Stream-Mode'] = 'true';
    		}
    		if (gather_links) {
    			headers['X-Gather-Links'] = 'true';
    		}
    		if (gather_images) {
    			headers['X-Gather-Images'] = 'true';
    		}
    		if (image_caption) {
    			headers['X-Image-Caption'] = 'true';
    		}
    		if (enable_iframe) {
    			headers['X-Enable-Iframe'] = 'true';
    		}
    		if (enable_shadow_dom) {
    			headers['X-Enable-Shadow-DOM'] = 'true';
    		}
    		if (!resolve_redirects) {
    			headers['X-No-Redirect'] = 'true';
    		}
    
    		try {
    			const response = await fetch(search_url, {
    				method: 'POST',
    				headers,
    			});
    
    			if (!response.ok) {
    				const error_text = await response.text();
    				throw new Error(error_text);
    			}
    
    			const result =
    				format === 'json'
    					? await response.json()
    					: await response.text();
    
    			return {
    				content: [
    					{
    						type: 'text',
    						text:
    							format === 'json'
    								? JSON.stringify(result, null, 2)
    								: result,
    					},
    				],
    			};
    		} catch (error) {
    			return {
    				content: [
    					{
    						type: 'text',
    						text: `Jina.ai API error: ${
    							error instanceof Error
    								? error.message
    								: String(error)
    						}`,
    					},
    				],
    				isError: true,
    			};
    		}
    	},
    );
  • Schema definition for the 'search' tool, specifying name, description, and detailed input schema with parameters such as query (required), format, token_budget, etc.
    const search_tool_schema = {
    	name: 'search',
    	description:
    		'Search the web and get clean, LLM-friendly content using Jina.ai Reader. Returns top 5 results with URLs and clean content.',
    	inputSchema: {
    		type: 'object',
    		properties: {
    			query: {
    				type: 'string',
    				description: 'Search query',
    			},
    			format: {
    				type: 'string',
    				description: 'Response format (json or text)',
    				enum: ['json', 'text'],
    				default: 'text',
    			},
    			no_cache: {
    				type: 'boolean',
    				description: 'Bypass cache for fresh results',
    				default: false,
    			},
    			token_budget: {
    				type: 'number',
    				description: 'Maximum number of tokens for this request',
    				minimum: 1,
    			},
    			browser_locale: {
    				type: 'string',
    				description: 'Browser locale for rendering content',
    			},
    			stream: {
    				type: 'boolean',
    				description: 'Enable stream mode for large pages',
    				default: false,
    			},
    			gather_links: {
    				type: 'boolean',
    				description: 'Gather all links at the end of the response',
    				default: false,
    			},
    			gather_images: {
    				type: 'boolean',
    				description: 'Gather all images at the end of the response',
    				default: false,
    			},
    			image_caption: {
    				type: 'boolean',
    				description: 'Caption images in the content',
    				default: false,
    			},
    			enable_iframe: {
    				type: 'boolean',
    				description: 'Extract content from iframes',
    				default: false,
    			},
    			enable_shadow_dom: {
    				type: 'boolean',
    				description: 'Extract content from shadow DOM',
    				default: false,
    			},
    			resolve_redirects: {
    				type: 'boolean',
    				description: 'Follow redirect chains to final URL',
    				default: true,
    			},
    		},
    		required: ['query'],
    	},
    };
  • src/index.ts:120-125 (registration)
    Registration of the 'search' tool by returning it in the ListToolsRequest handler.
    this.server.setRequestHandler(
    	ListToolsRequestSchema,
    	async () => ({
    		tools: [search_tool_schema],
    	}),
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool returns 'clean, LLM-friendly content' and 'top 5 results with URLs and clean content,' which gives some behavioral context. However, it lacks critical information about rate limits, authentication requirements, error conditions, or what constitutes 'clean' content, leaving significant gaps for a tool with 12 parameters.

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 perfectly concise and front-loaded: a single sentence that communicates the core functionality, method, and output format. Every word earns its place with zero redundancy or unnecessary elaboration.

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

Completeness3/5

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

For a search tool with 12 parameters and no output schema, the description provides basic purpose and output format but lacks sufficient behavioral context. Without annotations covering safety, limits, or authentication, and with no output schema to explain return values, the description should do more to compensate for these gaps, especially given the tool's complexity.

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?

Schema description coverage is 100%, so the schema fully documents all 12 parameters. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. According to guidelines, when schema coverage is high (>80%), the baseline score is 3 even with no parameter information in the description.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Search the web and get clean, LLM-friendly content using Jina.ai Reader.' It specifies the action (search), resource (web content), and processing method (Jina.ai Reader). However, without sibling tools, it cannot demonstrate differentiation from alternatives, preventing a score of 5.

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, prerequisites, or contextual constraints. It mentions returning 'top 5 results' but doesn't explain when this limitation is appropriate or when other search tools might be better suited.

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-jinaai-search'

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