Skip to main content
Glama

kb_add_custom

Add custom knowledge entries to structured categories for persistent storage and retrieval in AI systems, enabling long-term memory across sessions with optional tagging.

Instructions

Add custom knowledge to any category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory name (e.g., "tools", "workflows", "contacts")
keyYesKnowledge key/identifier
tagsNoOptional tags for categorization
valueYesKnowledge value (can be string, object, array, etc.)

Implementation Reference

  • The MCP tool handler for kb_add_custom. Extracts arguments and delegates to KnowledgeManager.addCustomKnowledge, returning 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}` } ] }; }
  • Tool definition including name, description, and input schema for registration in the tools list used by ListToolsRequestSchema.
    { 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'] } },
  • Core implementation in KnowledgeManager that adds or updates custom knowledge entry, tracks history, reinitializes search index, 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(); }

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/hlsitechio/mcp-instruct'

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