Skip to main content
Glama
Cognitive-Stack

Search Stock News MCP Server

general-search

Conduct general web searches with customizable parameters like query, result count, depth, and relevance score. Retrieve filtered and relevant results for specific needs using the Tavily API.

Instructions

Perform a general web search using Tavily API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum number of results to return
minScoreNoMinimum relevance score threshold
queryYesSearch query
searchDepthNoSearch depth level

Implementation Reference

  • The core handler function implementing the 'general-search' tool logic, performing web search via Tavily API, filtering and sorting results by score.
    export default async (
      query: string,
      maxResults: number = 10,
      searchDepth: 'basic' | 'advanced' = 'basic',
      minScore: number = 0.4
    ): Promise<GeneralSearchResult[]> => {
      const config = getConfig();
      const { apiKey } = config;
    
      // Initialize Tavily client
      const tvly = tavily({ apiKey });
    
      try {
        const response = await tvly.search(query, {
          searchDepth,
          maxResults,
          includeDomains: [],
          excludeDomains: []
        });
    
        // Transform and filter the results
        const filteredResults = response.results
          .map((result) => ({
            title: result.title,
            url: result.url,
            content: result.content,
            publishedDate: result.publishedDate,
            score: result.score,
          }))
          .filter(result => result.score >= minScore)
          .sort((a, b) => b.score - a.score);
    
        return filteredResults;
    
      } catch (error) {
        console.error(`Error performing general search: ${error}`);
        throw error;
      }
    }; 
  • Registration of the 'general-search' tool in the tools configuration array, including name, description, input schema, and wrapper execute function.
    {
      name: "general-search",
      description: "Perform a general web search using Tavily API",
      parameters: z.object({
        query: z.string().describe("Search query"),
        maxResults: z.number().optional().describe("Maximum number of results to return"),
        searchDepth: z.enum(["basic", "advanced"]).optional().describe("Search depth level"),
        minScore: z.number().optional().describe("Minimum relevance score threshold")
      }),
      execute: async (args) => {
        const results = await generalSearch(
          args.query,
          args.maxResults || 10,
          args.searchDepth || "basic",
          args.minScore || 0.4
        );
        return JSON.stringify(results, null, 2);
      }
    }
  • TypeScript interface defining the structure of each result returned by the general search tool.
    export interface GeneralSearchResult {
      title: string;
      url: string;
      content: string;
      publishedDate: string;
      score: number;
    }
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. While 'Perform a general web search' implies a read-only operation, it doesn't address important behavioral aspects like rate limits, authentication requirements, error handling, or what constitutes a 'general' versus specialized search. The mention of Tavily API is helpful but insufficient.

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 extremely concise - a single sentence that communicates the core purpose efficiently. There's no wasted language or unnecessary elaboration, making it easy to parse quickly.

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?

For a search tool with 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what results look like, how relevance scoring works, what the searchDepth levels mean, or provide any context about the Tavily API's capabilities or limitations.

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 description adds no parameter-specific information beyond what's already in the schema (which has 100% coverage). It doesn't explain what 'general web search' means in relation to the parameters like searchDepth levels or score thresholds. The baseline of 3 is appropriate since 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 action ('Perform a general web search') and specifies the resource/API used ('using Tavily API'), which distinguishes it from generic search tools. However, it doesn't explicitly differentiate from its sibling 'search-stock-news', which appears to be a more specialized search tool.

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. There's no mention of its sibling tool 'search-stock-news' or any other search tools, nor does it indicate appropriate contexts or exclusions for using this general web search.

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

Related 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/Cognitive-Stack/search-stock-news-mcp'

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