list_insights
Retrieve stored business insights and analysis notes from databases, with optional filtering by connection ID or tags.
Instructions
List all stored business insights and analysis notes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection | No | Filter insights by connection ID (optional) | |
| tags | No | Filter insights by tags (optional) |
Implementation Reference
- src/index.ts:990-1011 (handler)The handleListInsights function implements the core logic of the list_insights tool. It filters the stored insights based on optional connection ID and tags parameters and returns the results as JSON-formatted text content.
private async handleListInsights(args: { connection?: string; tags?: string[] }) { let filteredInsights = [...this.insights]; if (args.connection) { filteredInsights = filteredInsights.filter(insight => insight.connection === args.connection ); } if (args.tags && args.tags.length > 0) { filteredInsights = filteredInsights.filter(insight => insight.tags && args.tags!.some(tag => insight.tags!.includes(tag)) ); } return { content: [{ type: 'text' as const, text: JSON.stringify(filteredInsights, null, 2), }], }; } - src/index.ts:454-467 (schema)Defines the input JSON schema for the list_insights tool, specifying optional 'connection' string and 'tags' array parameters for filtering.
inputSchema: { type: 'object', properties: { connection: { type: 'string', description: 'Filter insights by connection ID (optional)', }, tags: { type: 'array', items: { type: 'string' }, description: 'Filter insights by tags (optional)', }, }, }, - src/index.ts:451-468 (registration)Registers the list_insights tool in the ListToolsRequestSchema response by defining its name, description, and input schema in the tools array.
{ name: 'list_insights', description: 'List all stored business insights and analysis notes', inputSchema: { type: 'object', properties: { connection: { type: 'string', description: 'Filter insights by connection ID (optional)', }, tags: { type: 'array', items: { type: 'string' }, description: 'Filter insights by tags (optional)', }, }, }, }, - src/index.ts:555-559 (registration)Maps the 'list_insights' tool name to its handler function in the CallToolRequestSchema switch statement.
case 'list_insights': return await this.handleListInsights(args as { connection?: string; tags?: string[] });