suggest_tags
Generate AI-suggested tags for Outline wiki documents to improve organization and searchability based on content analysis.
Instructions
Get AI-suggested tags for a document based on its content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentId | Yes |
Implementation Reference
- src/lib/handlers/smart.ts:133-154 (handler)MCP tool handler for suggest_tags: fetches document content via Outline API, calls brain.suggestTags, returns suggested tags.
async suggest_tags(args: { documentId: string }) { if (!brain.isEnabled()) { return { error: ERROR_MESSAGES.SMART_FEATURES_DISABLED }; } // Fetch document const { data } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.info', { id: args.documentId }) ); if (!data.text) { return { error: ERROR_MESSAGES.NO_CONTENT_TO_ANALYZE }; } const tags = await brain.suggestTags(data.text); return { documentId: data.id, title: data.title, suggestedTags: tags, }; }, - src/lib/schemas.ts:155-157 (schema)Zod input schema for suggest_tags tool: requires documentId.
export const suggestTagsSchema = z.object({ documentId, }); - src/lib/tools.ts:216-218 (registration)Registers the suggest_tags tool in allTools array using schema from schemas.ts and description.
'suggest_tags', 'Get AI-suggested tags for a document based on its content.', 'suggest_tags' - src/lib/brain/processor.ts:53-64 (helper)Core LLM implementation: prompts OpenAI to suggest 3-5 tags from document text, parses comma-separated output.
async suggestTags(text: string): Promise<string[]> { const prompt = `Analyze the following document and suggest 3-5 relevant tags. Output ONLY comma-separated tags without explanation. Example: Marketing, Q1 Report, Strategy`; const result = await this.complete(prompt, text.substring(0, LLM.MAX_TAG_ANALYSIS_CHARS)); return result .split(',') .map((tag) => tag.trim()) .filter((tag) => tag.length > 0); } - src/lib/brain/index.ts:170-173 (helper)Brain facade method: delegates tag suggestion to processor after checking if enabled.
async suggestTags(text: string): Promise<string[]> { this.checkEnabled(); return this.processor.suggestTags(text); }