Skip to main content
Glama

answers

Search the web to answer questions and return structured JSON data with sources and citations for research and analysis.

Instructions

Search the web and return AI-powered answers in the JSON structure you want, with sources and citations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYesQuestion or task to answer using web data.
jsonNoOptional JSON schema/object or a short description of the desired output shape. Example object: { "book_title": "", "author": "", "release_date": "" }

Implementation Reference

  • The handler function executes the core logic of the 'answers' tool by sending a POST request to the Olostep Answers API with the task and optional JSON schema, processing the response, and returning formatted content or error messages.
    handler: async (
    	{ task, json }: { task: string; json?: Record<string, unknown> | string },
    	apiKey: string,
    ) => {
    	try {
    		const headers = new Headers({
    			"Content-Type": "application/json",
    			Authorization: `Bearer ${apiKey}`,
    		});
    
    		const payload: Record<string, unknown> = { task };
    		if (typeof json !== "undefined") {
    			payload.json = json;
    		}
    
    		const response = await fetch(OLOSTEP_ANSWERS_API_URL, {
    			method: "POST",
    			headers,
    			body: JSON.stringify(payload),
    		});
    
    		if (!response.ok) {
    			let errorDetails: unknown = null;
    			try {
    				errorDetails = await response.json();
    			} catch {
    				// ignore
    			}
    			return {
    				isError: true,
    				content: [
    					{
    						type: "text",
    						text: `Olostep API Error: ${response.status} ${response.statusText}. Details: ${JSON.stringify(
    							errorDetails,
    						)}`,
    					},
    				],
    			};
    		}
    
    		const data = (await response.json()) as OlostepAnswersResponse;
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify(data, null, 2),
    				},
    			],
    		};
    	} catch (error: unknown) {
    		return {
    			isError: true,
    			content: [
    				{
    					type: "text",
    					text: `Error: Failed to get answer. ${error instanceof Error ? error.message : String(error)}`,
    				},
    			],
    		};
    	}
    },
  • The input schema for the 'answers' tool, defining 'task' as required string and 'json' as optional union of string or object for output shaping.
    schema: {
    	task: z.string().describe("Question or task to answer using web data."),
    	json: z
    		.union([z.string(), z.record(z.any())])
    		.optional()
    		.describe(
    			'Optional JSON schema/object or a short description of the desired output shape. Example object: { "book_title": "", "author": "", "release_date": "" }',
    		),
    },
  • src/index.ts:88-100 (registration)
    The registration of the 'answers' tool on the MCP server using server.tool(), including API key check and wrapper for the handler.
    // Register Answers (AI) tool
    server.tool(
        answers.name,
        answers.description,
        answers.schema,
        async (params) => {
            if (!OLOSTEP_API_KEY) return missingApiKeyError;
            const result = await answers.handler(params, OLOSTEP_API_KEY);
            return {
                ...result,
                content: result.content.map(item => ({ ...item, type: item.type as "text" }))
            };
        }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'AI-powered answers' and 'sources and citations', which hints at synthesis and attribution, but lacks details on behavioral traits like rate limits, authentication needs, response format beyond JSON, or whether it performs web searches in real-time. For a tool with no annotations, this leaves significant gaps in understanding its operation.

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 concise and front-loaded, stating the core functionality in one sentence. Every phrase ('Search the web', 'return AI-powered answers', 'JSON structure you want, with sources and citations') contributes meaning without redundancy. It could be slightly more structured by separating usage hints, but it's efficient overall.

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 no annotations, no output schema, and a tool that performs web searches and AI synthesis, the description is incomplete. It doesn't cover critical aspects like response format details, error handling, limitations (e.g., search depth), or how 'sources and citations' are structured in the output. For a complex tool with 2 parameters, this leaves too much undefined for effective agent use.

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 already documents both parameters ('task' and 'json') well. The description adds minimal value beyond the schema, mentioning 'JSON structure you want' which aligns with the 'json' parameter but doesn't provide additional semantics like examples or constraints. Baseline 3 is appropriate as the schema does the heavy lifting.

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 return AI-powered answers' with specific outputs ('JSON structure you want, with sources and citations'). It distinguishes from siblings like 'google_search' or 'scrape_website' by emphasizing AI-powered answer generation rather than raw search results or content extraction. However, it doesn't explicitly contrast with 'search_web' which might be similar.

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?

No explicit guidance on when to use this tool versus alternatives like 'google_search', 'search_web', or 'get_webpage_content'. The description implies usage for AI-powered answers with structured JSON output, but doesn't specify scenarios where this is preferred over simpler search tools or when not to use it (e.g., for raw data vs. synthesized answers).

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/olostep/olostep-mcp-server'

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