alphaIntelligence_insiderTransactions
Retrieve aggregated insider trading data for any stock symbol, enabling analysis of executive and institutional transactions to inform investment decisions.
Instructions
Fetches aggregated insider trading information for a given symbol.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | The stock symbol (e.g., "AAPL"). |
Input Schema (JSON Schema)
{
"additionalProperties": false,
"description": "Parameters for fetching insider trading information.",
"properties": {
"symbol": {
"description": "The stock symbol (e.g., \"AAPL\").",
"type": "string"
}
},
"required": [
"symbol"
],
"type": "object"
}
Implementation Reference
- src/index.ts:155-170 (registration)Tool registration including name, description, schema reference, and execute handler that delegates to executeAvantageTool calling the Alpha Vantage insiderTransactions method.server.addTool({ name: "alphaIntelligence_insiderTransactions", description: "Fetches aggregated insider trading information for a given symbol.", parameters: schemas.InsiderTransactionsParamsSchema, execute: ( args, context // Let type be inferred ) => executeAvantageTool( "alphaIntelligence_insiderTransactions", args, context, (av, params) => av.alphaIntelligence.insiderTransactions(params.symbol) ), });
- src/schemas.ts:21-23 (schema)Zod schema defining the input parameters for the tool: a required 'symbol' string.export const InsiderTransactionsParamsSchema = z.object({ symbol: z.string().describe('The stock symbol (e.g., "AAPL").'), }).describe('Parameters for fetching insider trading information.')
- src/index.ts:38-60 (helper)Shared helper function used by all tools to execute Alpha Vantage API calls, handling client management, caching, and error handling. Specific callback for this tool invokes av.alphaIntelligence.insiderTransactions.async function executeAvantageTool<TArgs, TResult>( toolName: string, args: TArgs, context: Context<Record<string, unknown> | undefined>, // Use the imported Context type directly avantageMethod: ( av: AVantage, args: TArgs ) => Promise<{ error?: boolean; reason?: string; data?: TResult }> ): Promise<string> { logger.info(`Executing '${toolName}' tool for request ID: ${context}`); logger.debug(`Args for ${toolName}: ${JSON.stringify(args)}`); // --- Authentication & Resource Management --- // Access extraArgs safely - it might be null or undefined const extraArgsApiKey = context.extraArgs?.apiKey as string | undefined; const apiKey = extraArgsApiKey || config.apiKey; if (!apiKey) { logger.error(`'${toolName}' failed: Alpha Vantage API key missing.`); throw new UserError(apiKeyErrorMessage); } logger.debug( `Using AV API key (source: ${extraArgsApiKey ? "extraArgs" : "environment"}) for ${toolName}`