Skip to main content
Glama

explain_directive

Understand NoJS framework directives by retrieving detailed explanations with syntax examples and usage guidance for template development.

Instructions

Get a detailed explanation of a NoJS directive with syntax and examples

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directiveYesThe directive name to explain (e.g., "bind", "each", "model")

Implementation Reference

  • The `explain_directive` tool is defined and implemented in `src/tools/index.ts`. It takes a `directive` name as input, looks it up in `directives.json`, and returns a detailed explanation including category, syntax, examples, and notes.
    // ── explain_directive ──
    server.tool(
        "explain_directive",
        "Get a detailed explanation of a NoJS directive with syntax and examples",
        {
            directive: z
                .string()
                .describe(
                    'The directive name to explain (e.g., "bind", "each", "model")'
                ),
        },
        async ({ directive }) => {
            const kb = loadJSON<DirectivesKB>("directives.json");
            const name = directive.toLowerCase().trim();
    
            // Find exact match or partial match
            const found = kb.directives.find(
                (d) =>
                    d.name === name ||
                    d.name === `${name}` ||
                    d.name.startsWith(name)
            );
    
            if (!found) {
                // Suggest similar
                const suggestions = kb.directives
                    .filter(
                        (d) => d.name.includes(name) || d.category.includes(name)
                    )
                    .map((d) => d.name)
                    .slice(0, 5);
    
                return {
                    content: [
                        {
                            type: "text" as const,
                            text: `Directive "${directive}" not found.${suggestions.length > 0 ? ` Did you mean: ${suggestions.join(", ")}?` : ""}\n\nUse list_directives to see all available directives.`,
                        },
                    ],
                };
            }
    
            const category = kb.categories.find((c) => c.id === found.category);
            let explanation = `# ${found.name}\n\n`;
            explanation += `**Category**: ${category?.name || found.category}\n`;
            explanation += `**Description**: ${found.description}\n\n`;
            explanation += `## Syntax\n\n\`\`\`html\n${found.syntax}\n\`\`\`\n\n`;
    
            if (found.examples && found.examples.length > 0) {
                explanation += `## Examples\n\n`;
                for (const ex of found.examples) {
                    explanation += `### ${ex.description}\n\n\`\`\`html\n${ex.html}\n\`\`\`\n\n`;
                }
            }
    
            if (found.notes) {
                explanation += `## Notes\n\n${found.notes}\n`;
            }
    
            return {
                content: [{ type: "text" as const, text: explanation }],
            };
        }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool provides explanations with syntax and examples, but doesn't cover aspects like whether it's read-only, if it requires authentication, rate limits, error handling, or the format of the detailed explanation. This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get a detailed explanation') and includes key details ('with syntax and examples'). There is no wasted verbiage, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It explains what the tool does but lacks details on behavioral traits and usage context. Without annotations or output schema, more completeness would be beneficial, but it's not severely lacking.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'directive' documented as 'The directive name to explain (e.g., "bind", "each", "model").' The description adds no additional parameter semantics beyond this, so it meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get a detailed explanation of a NoJS directive with syntax and examples.' It specifies the verb ('Get a detailed explanation') and resource ('a NoJS directive'), though it doesn't explicitly differentiate from sibling tools like 'list_directives' or 'get_cheatsheet.'

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_directives' (which might list directives without details) or 'get_cheatsheet' (which could provide broader information), leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ErickXavier/nojs-mcp'

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