agentbay_brain_import
Import operational knowledge into your Brain using markdown (split by ## sections) or JSONL (one entry per line) to store structured knowledge.
Instructions
Import operational knowledge into your Brain. Accepts markdown (splits by ## headers) or JSONL (one entry per line).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Brain project ID (from brain_setup) | |
| format | Yes | Input format | |
| content | Yes | The knowledge content to import |
Implementation Reference
- src/index.ts:996-1020 (registration)Registration of the 'agentbay_brain_import' tool using server.tool() with name 'agentbay_brain_import' and description 'Import operational knowledge into your Brain.'
// Tool 36: Brain Import server.tool( 'agentbay_brain_import', 'Import operational knowledge into your Brain. Accepts markdown (splits by ## headers) or JSONL (one entry per line).', { projectId: z.string().describe('Brain project ID (from brain_setup)'), format: z.enum(['markdown', 'jsonl']).describe('Input format'), content: z.string().describe('The knowledge content to import'), }, async ({ projectId: pid, format: fmt, content: cnt }) => { const data = await apiPost('/api/v1/brain/import', { projectId: pid, format: fmt, content: cnt }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; let summary = `Imported: ${data.imported} new, ${data.deduplicated} deduped`; if (data.poisonBlocked > 0) summary += `, ${data.poisonBlocked} blocked (poison)`; if (data.errors > 0) summary += `, ${data.errors} errors`; summary += ` (${data.total} total)`; if (data.entries?.length) { summary += '\n\nEntries:\n' + data.entries.map((e: any) => ` ${e.status}: ${e.title}`).join('\n'); } return { content: [{ type: 'text' as const, text: summary }] }; } ); - src/index.ts:1000-1004 (schema)Input schema for agentbay_brain_import: projectId (string), format (enum markdown|jsonl), content (string)
{ projectId: z.string().describe('Brain project ID (from brain_setup)'), format: z.enum(['markdown', 'jsonl']).describe('Input format'), content: z.string().describe('The knowledge content to import'), }, - src/index.ts:1005-1020 (handler)Handler for agentbay_brain_import: posts to /api/v1/brain/import with projectId, format, content; returns import summary with counts of imported, deduplicated, poison-blocked entries.
async ({ projectId: pid, format: fmt, content: cnt }) => { const data = await apiPost('/api/v1/brain/import', { projectId: pid, format: fmt, content: cnt }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; let summary = `Imported: ${data.imported} new, ${data.deduplicated} deduped`; if (data.poisonBlocked > 0) summary += `, ${data.poisonBlocked} blocked (poison)`; if (data.errors > 0) summary += `, ${data.errors} errors`; summary += ` (${data.total} total)`; if (data.entries?.length) { summary += '\n\nEntries:\n' + data.entries.map((e: any) => ` ${e.status}: ${e.title}`).join('\n'); } return { content: [{ type: 'text' as const, text: summary }] }; } );