list_directives
List all NoJS framework directives to help developers reference available functionality, with optional filtering by category for targeted exploration.
Instructions
List all NoJS directives, optionally filtered by category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter by category: data, state, binding, conditionals, loops, events, styling, forms, routing, animation, dnd, i18n, refs, misc |
Implementation Reference
- src/tools/index.ts:227-285 (handler)Implementation of the list_directives tool handler.
// ── list_directives ── server.tool( "list_directives", "List all NoJS directives, optionally filtered by category", { category: z .string() .optional() .describe( 'Filter by category: data, state, binding, conditionals, loops, events, styling, forms, routing, animation, dnd, i18n, refs, misc' ), }, async ({ category }) => { const kb = loadJSON<DirectivesKB>("directives.json"); let directives = kb.directives; if (category) { directives = directives.filter( (d) => d.category === category.toLowerCase() ); } if (directives.length === 0) { const cats = kb.categories.map((c) => c.id).join(", "); return { content: [ { type: "text" as const, text: `No directives found for category "${category}". Available categories: ${cats}`, }, ], }; } // Group by category const groups: Record<string, typeof directives> = {}; for (const d of directives) { if (!groups[d.category]) groups[d.category] = []; groups[d.category].push(d); } let output = `# NoJS Directives${category ? ` (${category})` : ""}\n\n`; output += `Total: ${directives.length} directives\n\n`; for (const [cat, items] of Object.entries(groups)) { const catInfo = kb.categories.find((c) => c.id === cat); output += `## ${catInfo?.name || cat}\n\n`; output += `| Directive | Description |\n|---|---|\n`; for (const d of items) { output += `| \`${d.name}\` | ${d.description} |\n`; } output += `\n`; } return { content: [{ type: "text" as const, text: output }], }; } );