kb_add_custom
Add custom knowledge entries to structured categories for persistent storage and retrieval in the MCP Instruct server's knowledge base.
Instructions
Add custom knowledge to any category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | Category name (e.g., "tools", "workflows", "contacts") | |
| key | Yes | Knowledge key/identifier | |
| value | Yes | Knowledge value (can be string, object, array, etc.) | |
| tags | No | Optional tags for categorization |
Implementation Reference
- src/index.ts:153-178 (registration)Registration of the 'kb_add_custom' tool including name, description, and input schema for listing tools.{ name: 'kb_add_custom', description: 'Add custom knowledge to any category', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category name (e.g., "tools", "workflows", "contacts")' }, key: { type: 'string', description: 'Knowledge key/identifier' }, value: { description: 'Knowledge value (can be string, object, array, etc.)' }, tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags for categorization' } }, required: ['category', 'key', 'value'] } },
- src/index.ts:606-617 (handler)Tool handler that parses arguments, calls KnowledgeManager.addCustomKnowledge, and returns success message.case 'kb_add_custom': { const { category, key, value, tags } = args as any; await km.addCustomKnowledge(category, key, value, tags); return { content: [ { type: 'text', text: `✅ Added custom knowledge: ${category}/${key}` } ] }; }
- src/KnowledgeManager.ts:207-242 (helper)Core helper method in KnowledgeManager that implements adding or updating custom knowledge, manages history, and persists to file.async addCustomKnowledge(category: string, key: string, value: any, tags?: string[]): Promise<void> { const existing = this.kb.custom.findIndex(k => k.category === category && k.key === key); const customKnowledge: CustomKnowledge = { category, key, value, metadata: { addedAt: new Date().toISOString(), lastUpdated: new Date().toISOString(), tags } }; if (existing >= 0) { const oldValue = this.kb.custom[existing].value; this.kb.custom[existing] = customKnowledge; this.addHistory({ action: 'update', category: `custom:${category}`, field: key, oldValue, newValue: value }); } else { this.kb.custom.push(customKnowledge); this.addHistory({ action: 'add', category: `custom:${category}`, field: key, newValue: value }); } await this.save(); }