Skip to main content
Glama
stockmarketscan

stockmarketscan/mcp-server

Official

get_trends

Read-onlyIdempotent

Retrieve AI-detected trending topics in tech, science, patents, or funding events. Specify category and time window to get trends with relevance weights.

Instructions

Return AI-detected trending topics in tech & science, patents, or funding events. Use when the user asks 'what's trending in tech' or 'show me patent trends'. Returns { category, count, trends: [{date, topic, weight}] } where weight is 0-1. Tier: Pro only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoTrend categorytechscience
daysNoLookback window
latestNoIf true, only return most recent day
dateNoExact date lookup

Implementation Reference

  • The actual handler function for the get_trends tool. Parses input via GetTrendsInputSchema, builds a cache key, and calls ctx.apiClient.get('/trends', ...) with the category, days, latest, and date parameters.
    export async function handleGetTrends(ctx: McpContext, rawArgs: unknown): Promise<unknown> {
      const args = GetTrendsInputSchema.parse(rawArgs);
      const category = args.category ?? "techscience";
      const days = args.days ?? 10;
      const key = `trends:${category}:${days}:${args.latest ? "latest" : args.date || "range"}`;
      return ctx.cache.wrap(key, 1_800_000, () =>
        ctx.apiClient.get("/trends", {
          category,
          days,
          latest: args.latest ? 1 : undefined,
          date: args.date,
        })
      );
    }
  • Zod schema defining the input for get_trends: optional category enum (techscience/patents/fundingevents, default techscience), days (1-180, default 10), latest boolean, and date regex string.
    export const GetTrendsInputSchema = z.object({
      category: z
        .enum(["techscience", "patents", "fundingevents"])
        .default("techscience")
        .optional()
        .describe("Trend category"),
      days: z.number().int().min(1).max(180).default(10).optional().describe("Lookback window"),
      latest: z.boolean().default(false).optional().describe("If true, only return most recent day"),
      date: z.string().regex(dateRegex).optional().describe("Exact date lookup"),
    });
  • The registerAllTools function registers the get_trends tool by spreading trendsTools into ALL_TOOLS and mapping the handler in HANDLERS: get_trends: (ctx, args) => handleGetTrends(ctx, args).
    export function registerAllTools(server: Server, ctx: McpContext): void {
      server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: ALL_TOOLS,
      }));
  • The Tool definition object for get_trends, including the name, description, inputSchema (from GetTrendsInputSchema), and read-only annotations.
    export const trendsTools: Tool[] = [
      {
        name: "get_trends",
        description:
          "Return AI-detected trending topics in tech & science, patents, or funding events. Use when the user asks 'what's trending in tech' or 'show me patent trends'. Returns { category, count, trends: [{date, topic, weight}] } where weight is 0-1. Tier: Pro only.",
        inputSchema: z.toJSONSchema(GetTrendsInputSchema) as Tool["inputSchema"],
        annotations: READ_ONLY_ANNOTATIONS,
      },
  • ALL_TOOLS array that includes trendsTools (spread), which contains the get_trends tool definition.
    const ALL_TOOLS: Tool[] = [
      PING_TOOL,
      ...screenersTools,
      ...patternsTools,
      ...optionsFlowTools,
      ...stockTools,
      ...compositeTools,
      ...marketMomentumTools,
      ...trendsTools,
      ...educationTools,
    ];
Behavior4/5

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

Annotations already declare the tool is read-only, non-destructive, idempotent, and open-world. The description adds the return format structure and weight scale (0-1), plus the Pro tier restriction, providing useful behavioral context beyond annotations.

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?

Four concise sentences covering purpose, usage, return format, and access tier. No filler, front-loaded with the main action. Earns its sentences efficiently.

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

Completeness5/5

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

Given no output schema, the description provides the output format. It covers all necessary aspects: purpose, category options, date range, latest flag, exact date, return structure, and access level. Complete for an agent to use correctly.

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 coverage is 100% with good parameter descriptions. The description adds usage examples ('what's trending in tech') but does not significantly enhance parameter meaning beyond what the schema provides.

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

Purpose5/5

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

The description clearly states the tool returns AI-detected trending topics in specific domains (tech/science, patents, funding events). It distinguishes itself from sibling tools like get_chart_patterns and get_options_flow_signals by focusing on trend categories.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Use when the user asks...' with example queries, providing clear context for when to invoke this tool. Also notes 'Tier: Pro only', indicating access prerequisites.

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

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