Skip to main content
Glama
elegroag

Backbone.js Documentation MCP Server

by elegroag

Buscar en capítulos Backbone

search-backbone

Search Backbone.js documentation chapters for specific text and retrieve relevant chapter links with matching excerpts.

Instructions

Busca texto en los capítulos Markdown y devuelve enlaces a los capítulos con coincidencias.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesTexto a buscar
caseSensitiveNoDistinguir mayúsculas/minúsculas
maxExcerptsNoNúmero de fragmentos por capítulo

Implementation Reference

  • The main handler function for the 'search-backbone' tool. It takes input arguments, calls searchResources from mcp-server, and formats search results into MCP content with introductory text and resource links to matching chapters.
    async (args) => {
        const query = args.query;
        const caseSensitive = args.caseSensitive;
        const maxExcerpts = args.maxExcerpts;
        const results = searchResources(query, { caseSensitive, maxExcerpts });
        if (!results.length) {
            return {
                content: [
                    { type: "text", text: `Sin coincidencias para "${query}".` }
                ]
            };
        }
    
        const content: Array<any> = [];
        content.push({ type: "text", text: `Coincidencias: ${results.length} capítulos para "${query}".` });
        for (const r of results) {
            content.push({
                type: "resource_link",
                uri: r.uri,
                name: `Capítulo ${String(r.chapter).padStart(2, '0')} — ${r.title}`,
                mimeType: r.mimeType,
                description: r.excerpts[0] ?? undefined,
            });
        }
    
        return { content };
    }
  • Zod-based input schema defining the parameters for the 'search-backbone' tool: required query string, optional case-sensitive flag, and max excerpts.
    {
        title: "Buscar en capítulos Backbone",
        description: "Busca texto en los capítulos Markdown y devuelve enlaces a los capítulos con coincidencias.",
        inputSchema: {
            query: z.string().min(2, 'La consulta debe tener al menos 2 caracteres').describe('Texto a buscar'),
            caseSensitive: z.boolean().optional().describe('Distinguir mayúsculas/minúsculas'),
            maxExcerpts: z.number().int().min(1).max(5).optional().describe('Número de fragmentos por capítulo'),
        }
    },
  • src/server.ts:65-103 (registration)
    MCP server registration of the 'search-backbone' tool, including name, schema, and handler function.
    server.registerTool(
        "search-backbone",
        {
            title: "Buscar en capítulos Backbone",
            description: "Busca texto en los capítulos Markdown y devuelve enlaces a los capítulos con coincidencias.",
            inputSchema: {
                query: z.string().min(2, 'La consulta debe tener al menos 2 caracteres').describe('Texto a buscar'),
                caseSensitive: z.boolean().optional().describe('Distinguir mayúsculas/minúsculas'),
                maxExcerpts: z.number().int().min(1).max(5).optional().describe('Número de fragmentos por capítulo'),
            }
        },
        async (args) => {
            const query = args.query;
            const caseSensitive = args.caseSensitive;
            const maxExcerpts = args.maxExcerpts;
            const results = searchResources(query, { caseSensitive, maxExcerpts });
            if (!results.length) {
                return {
                    content: [
                        { type: "text", text: `Sin coincidencias para "${query}".` }
                    ]
                };
            }
    
            const content: Array<any> = [];
            content.push({ type: "text", text: `Coincidencias: ${results.length} capítulos para "${query}".` });
            for (const r of results) {
                content.push({
                    type: "resource_link",
                    uri: r.uri,
                    name: `Capítulo ${String(r.chapter).padStart(2, '0')} — ${r.title}`,
                    mimeType: r.mimeType,
                    description: r.excerpts[0] ?? undefined,
                });
            }
    
            return { content };
        }
    );
  • Core search utility function that loads resources, performs regex-based text search on chapter contents, extracts contextual excerpts, counts matches per chapter, and returns sorted list of SearchMatch objects used by the tool handler.
    export const searchResources = (
        query: string,
        opts?: { caseSensitive?: boolean; maxExcerpts?: number }
    ): SearchMatch[] => {
        const q = (query ?? '').trim();
        if (!q) return [];
    
        loadResources();
    
        const escapeRegExp = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
        const flags = opts?.caseSensitive ? 'g' : 'gi';
        const regex = new RegExp(escapeRegExp(q), flags);
        const maxExcerpts = Math.max(1, Math.min(10, opts?.maxExcerpts ?? 3));
    
        const matches: SearchMatch[] = [];
    
        for (const r of cachedResources) {
            const text = r.content.text ?? '';
            if (!text) continue;
    
            let occurrences = 0;
            const excerpts: string[] = [];
    
            let m: RegExpExecArray | null;
            while ((m = regex.exec(text)) !== null) {
                occurrences++;
                if (excerpts.length < maxExcerpts) {
                    const start = Math.max(0, m.index - 60);
                    const end = Math.min(text.length, m.index + m[0].length + 60);
                    const snippet = `${start > 0 ? '…' : ''}${text
                        .slice(start, end)
                        .replace(/\s+/g, ' ')
                        .trim()}${end < text.length ? '…' : ''}`;
                    excerpts.push(snippet);
                }
                if (regex.lastIndex === m.index) regex.lastIndex++; // evitar bucles con coincidencias vacías
            }
    
            if (occurrences > 0) {
                const chapter = r.metadata?.chapter ?? 0;
                const title = r.metadata?.title ?? `Capítulo ${chapter}`;
                const uri = `backbone://chapter/${String(chapter).padStart(2, '0')}`;
                matches.push({
                    chapter,
                    title,
                    uri,
                    mimeType: r.content.mimeType,
                    occurrences,
                    excerpts,
                });
            }
        }
    
        return matches.sort((a, b) => b.occurrences - a.occurrences);
    }
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 mentions searching and returning links, but does not cover important aspects like whether this is a read-only operation, potential rate limits, authentication needs, or how results are formatted (e.g., pagination). For a search tool with zero annotation coverage, this is a significant gap.

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 clearly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 moderate complexity (search with three parameters) and no output schema, the description is minimally adequate. It covers what the tool does but lacks details on behavioral traits and output format. With no annotations, it should do more to compensate, but the clear purpose and concise structure keep it from being lower.

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 schema description coverage is 100%, meaning all parameters are documented in the schema itself. The description does not add any additional meaning or context beyond what the schema provides (e.g., it doesn't explain how 'maxExcerpts' affects output or provide examples). Baseline 3 is appropriate when the schema does the heavy lifting.

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: 'Busca texto en los capítulos Markdown y devuelve enlaces a los capítulos con coincidencias' (Search text in Markdown chapters and returns links to chapters with matches). It specifies the verb (search), resource (Markdown chapters), and output (links to matching chapters). However, since there are no sibling tools mentioned, it cannot distinguish from alternatives, preventing a perfect score of 5.

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 does not mention any prerequisites, exclusions, or specific contexts for usage. With no sibling tools, there is no explicit comparison, but general usage context is still missing.

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/elegroag/backbone-mcp-server'

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