Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

append_insight

Add business insights and analysis notes to database memos with optional tags and connection associations for better data documentation.

Instructions

Add a business insight or analysis note to the memo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNoOptional connection ID to associate with this insight
insightYesThe business insight or analysis note to store
tagsNoOptional tags to categorize the insight

Implementation Reference

  • The main handler function for the 'append_insight' tool. Validates the input insight, creates a new BusinessInsight object with timestamp, optional connection and tags, appends it to the in-memory insights array, saves to a JSON file in tmp dir, and returns a success response with the new insight ID.
    private async handleAppendInsight(args: { insight: string; connection?: string; tags?: string[] }) { if (!args.insight || args.insight.trim().length === 0) { throw new McpError(ErrorCode.InvalidParams, 'Insight text is required'); } const newInsight: BusinessInsight = { id: Date.now(), insight: args.insight.trim(), created_at: new Date().toISOString(), connection: args.connection, tags: args.tags || [] }; this.insights.push(newInsight); this.saveInsights(); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, message: 'Insight added successfully', id: newInsight.id }, null, 2), }], }; }
  • Tool schema definition including name, description, and inputSchema with properties for insight (required string), optional connection string, and optional tags array.
    name: 'append_insight', description: 'Add a business insight or analysis note to the memo', inputSchema: { type: 'object', properties: { insight: { type: 'string', description: 'The business insight or analysis note to store', }, connection: { type: 'string', description: 'Optional connection ID to associate with this insight', }, tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags to categorize the insight', }, }, required: ['insight'], },
  • src/index.ts:548-553 (registration)
    Registration in the tool dispatcher switch statement within CallToolRequestSchema handler, which routes calls to the handleAppendInsight method.
    case 'append_insight': return await this.handleAppendInsight(args as { insight: string; connection?: string; tags?: string[] });
  • Helper method called by handleAppendInsight to persist the insights array to a JSON file in the system's tmp directory.
    private saveInsights() { try { fs.writeFileSync(this.insightsFile, JSON.stringify(this.insights, null, 2)); } catch (error) { this.log(`Failed to save insights: ${error}`, 'error'); } }
  • Helper method to load existing insights from the JSON file on server startup, used to initialize the insights array before handling append_insight calls.
    private loadInsights() { try { if (fs.existsSync(this.insightsFile)) { const data = fs.readFileSync(this.insightsFile, 'utf-8'); this.insights = JSON.parse(data); } } catch (error) { this.log(`Failed to load insights: ${error}`, 'debug'); this.insights = []; } }

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

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