trend_watcher
Monitor emerging trends, regulatory shifts, and adoption signals in any market sector. Get trend cards with momentum scores and opportunity windows to time product roadmaps.
Instructions
Monitor emerging trends, regulatory shifts and adoption signals for a given market sector. Returns 5-12 trend cards, each with a momentum score (rising/stable/declining), a 3-month and 12-month outlook, opportunity windows, and recommended actions. When to use this tool: the user asks what is heating up in a market, wants to time a product roadmap or content calendar, or needs an early read on a sector. Inputs: a sector to monitor and 3-8 keywords defining the watch perimeter. Delivered by Manue, the AI CMO of the Gapup portfolio.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sector | Yes | Sector to monitor (e.g. 'B2B SaaS productivity', 'EU fintech', 'climate-tech hardware') | |
| keywords | Yes | 3-8 keywords describing the watch perimeter | |
| focus | No | Optional context (geography, language target, comparator window, etc.) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| executiveSummary | Yes | Board-ready sector overview prose | |
| trends | Yes | 5-12 trend cards for the sector | |
| kpis | No | 3-5 headline KPI bubbles | |
| recommendations | No | Prioritised strategic recommendations |
Implementation Reference
- src/tools/trend-watcher.ts:1-112 (handler)The main tool implementation file for 'trend_watcher'. Defines the tool schema (input/output), and the handle function that calls the external Gapup API endpoint.
import { callGapupEndpoint } from "../client.js"; export const tool = { name: "trend_watcher", description: "Monitor emerging trends, regulatory shifts and adoption signals for a given market sector. Returns 5-12 trend cards, each with a momentum score (rising/stable/declining), a 3-month and 12-month outlook, opportunity windows, and recommended actions. When to use this tool: the user asks what is heating up in a market, wants to time a product roadmap or content calendar, or needs an early read on a sector. Inputs: a sector to monitor and 3-8 keywords defining the watch perimeter. Delivered by Manue, the AI CMO of the Gapup portfolio.", inputSchema: { type: "object", properties: { sector: { type: "string", minLength: 2, maxLength: 160, description: "Sector to monitor (e.g. 'B2B SaaS productivity', 'EU fintech', 'climate-tech hardware')", }, keywords: { type: "array", items: { type: "string", minLength: 2, maxLength: 60 }, minItems: 3, maxItems: 8, description: "3-8 keywords describing the watch perimeter", }, focus: { type: "string", maxLength: 400, description: "Optional context (geography, language target, comparator window, etc.)", }, }, required: ["sector", "keywords"], }, outputSchema: { type: "object", properties: { executiveSummary: { type: "string", description: "Board-ready sector overview prose", }, trends: { type: "array", description: "5-12 trend cards for the sector", items: { type: "object", properties: { title: { type: "string" }, momentum: { type: "string", enum: ["rising", "stable", "declining"] }, description: { type: "string" }, outlook3mo: { type: "string" }, outlook12mo: { type: "string" }, opportunityWindows: { type: "array", items: { type: "string" }, }, recommendedActions: { type: "array", items: { type: "string" }, }, sources: { type: "array", items: { type: "object", properties: { url: { type: "string" }, excerpt: { type: "string" }, }, required: ["url"], }, }, }, required: ["title", "momentum", "description", "outlook3mo", "outlook12mo"], }, }, kpis: { type: "array", description: "3-5 headline KPI bubbles", items: { type: "object", properties: { label: { type: "string" }, value: { type: "string" }, trend: { type: "string", enum: ["up", "down", "stable"] }, }, required: ["label", "value"], }, }, recommendations: { type: "array", description: "Prioritised strategic recommendations", items: { type: "object", properties: { action: { type: "string" }, rationale: { type: "string" }, horizon: { type: "string" }, }, required: ["action", "rationale"], }, }, }, required: ["executiveSummary", "trends"], }, annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: true, title: "Market Trend Watch", }, } as const; export async function handle(input: unknown, signal?: AbortSignal): Promise<unknown> { return callGapupEndpoint("trend-watcher", input, signal); } - src/tools/trend-watcher.ts:3-108 (schema)Full input and output schema definition for the trend_watcher tool, including required fields (sector, keywords), optional focus, and output structure (executiveSummary, trends[], kpis[], recommendations[]).
export const tool = { name: "trend_watcher", description: "Monitor emerging trends, regulatory shifts and adoption signals for a given market sector. Returns 5-12 trend cards, each with a momentum score (rising/stable/declining), a 3-month and 12-month outlook, opportunity windows, and recommended actions. When to use this tool: the user asks what is heating up in a market, wants to time a product roadmap or content calendar, or needs an early read on a sector. Inputs: a sector to monitor and 3-8 keywords defining the watch perimeter. Delivered by Manue, the AI CMO of the Gapup portfolio.", inputSchema: { type: "object", properties: { sector: { type: "string", minLength: 2, maxLength: 160, description: "Sector to monitor (e.g. 'B2B SaaS productivity', 'EU fintech', 'climate-tech hardware')", }, keywords: { type: "array", items: { type: "string", minLength: 2, maxLength: 60 }, minItems: 3, maxItems: 8, description: "3-8 keywords describing the watch perimeter", }, focus: { type: "string", maxLength: 400, description: "Optional context (geography, language target, comparator window, etc.)", }, }, required: ["sector", "keywords"], }, outputSchema: { type: "object", properties: { executiveSummary: { type: "string", description: "Board-ready sector overview prose", }, trends: { type: "array", description: "5-12 trend cards for the sector", items: { type: "object", properties: { title: { type: "string" }, momentum: { type: "string", enum: ["rising", "stable", "declining"] }, description: { type: "string" }, outlook3mo: { type: "string" }, outlook12mo: { type: "string" }, opportunityWindows: { type: "array", items: { type: "string" }, }, recommendedActions: { type: "array", items: { type: "string" }, }, sources: { type: "array", items: { type: "object", properties: { url: { type: "string" }, excerpt: { type: "string" }, }, required: ["url"], }, }, }, required: ["title", "momentum", "description", "outlook3mo", "outlook12mo"], }, }, kpis: { type: "array", description: "3-5 headline KPI bubbles", items: { type: "object", properties: { label: { type: "string" }, value: { type: "string" }, trend: { type: "string", enum: ["up", "down", "stable"] }, }, required: ["label", "value"], }, }, recommendations: { type: "array", description: "Prioritised strategic recommendations", items: { type: "object", properties: { action: { type: "string" }, rationale: { type: "string" }, horizon: { type: "string" }, }, required: ["action", "rationale"], }, }, }, required: ["executiveSummary", "trends"], }, annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: true, title: "Market Trend Watch", }, } as const; - src/index.ts:22-22 (registration)Import of the trend_watcher tool definition and handle function from its module.
import { tool as trendWatcherTool, handle as trendWatcherHandle } from "./tools/trend-watcher.js"; - src/index.ts:38-38 (registration)Registration of trend_watcher in the TOOLS array used by the MCP server to list and dispatch tool calls.
{ def: trendWatcherTool, handle: trendWatcherHandle }, - src/client.ts:26-86 (helper)The callGapupEndpoint helper function invoked by the trend_watcher handle to POST to the '/api/agent/trend-watcher' endpoint with auth, error handling for 401/402/404/429, and response parsing.
export async function callGapupEndpoint( slug: string, input: unknown, signal?: AbortSignal ): Promise<unknown> { const apiKey = process.env.GAPUP_API_KEY; if (!apiKey) { throw new GapupAuthError( "GAPUP_API_KEY environment variable required. Get a free tier key (100 calls/mo) at https://hub.gapup.io/agents-api/onboard" ); } const res = await fetch(`${HUB_BASE_URL}/api/agent/${slug}`, { method: "POST", headers: { "Content-Type": "application/json", "X-Api-Key": apiKey, "Accept": "application/json", "User-Agent": "@gapup/mcp-knowledge/0.1.0", }, body: JSON.stringify(input), signal, }); if (res.status === 401) { throw new GapupAuthError( "Invalid or missing GAPUP_API_KEY. Verify your key at https://hub.gapup.io/agents-api/onboard" ); } if (res.status === 402) { const body = await res.text().catch(() => ""); throw new GapupAuthError( `Free tier quota exhausted or paid auth required. Upgrade at https://hub.gapup.io/agents-api (received 402: ${body.slice(0, 120)})` ); } if (res.status === 404) { throw new GapupApiError( 404, `Endpoint '${slug}' not found — check GAPUP_API_BASE_URL or update the package (npm update @gapup/mcp-knowledge)` ); } if (res.status === 429) { const retryAfter = res.headers.get("Retry-After"); const retryMsg = retryAfter ? ` Retry after ${retryAfter} seconds.` : ""; const body = await res.text().catch(() => ""); throw new GapupApiError( 429, `Rate limit exceeded.${retryMsg} Upgrade your plan at https://hub.gapup.io/agents-api (received: ${body.slice(0, 100)})` ); } if (!res.ok) { const body = await res.text().catch(() => ""); throw new GapupApiError(res.status, body); } return res.json(); }