Skip to main content
Glama
sorodriguezz

IRIS ObjectScript MCP Server

by sorodriguezz

search_objectscript

Search locally cached ObjectScript documentation and code examples to find relevant programming information and implementation guidance.

Instructions

Search for ObjectScript documentation and examples (solo en caché local)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesSearch query

Implementation Reference

  • Handler function for the 'search_objectscript' tool. Extracts the query from arguments, calls searchInCache, and returns formatted search results as text content.
    case "search_objectscript": { const query = args?.q as string; if (!query) { throw new Error("Query is required"); } const results = await searchInCache(query); return { content: [ { type: "text", text: `Resultados de búsqueda para "${query}":\n\n${results}`, }, ], }; }
  • Defines the Tool object for 'search_objectscript' including name, description, and input schema requiring a 'q' query string.
    export const SEARCH_OBJECTSCRIPT: Tool = { name: "search_objectscript", description: "Search for ObjectScript documentation and examples (solo en caché local)", inputSchema: { type: "object", properties: { q: { type: "string", description: "Search query", minLength: 2, }, }, required: ["q"], }, };
  • Registers the 'search_objectscript' tool (via SEARCH_OBJECTSCRIPT) in the coreTools list used for MCP tool listing.
    export const coreTools = async () => { return { tools: [SMART_SEARCH, SEARCH_OBJECTSCRIPT, OPEN_BY_KEY, OPEN_CLASS], }; };
  • Core helper function that performs the actual search in the local cache directory for markdown files containing the query, extracts matches with context, and formats the results.
    export async function searchInCache(query: string): Promise<string> { const results: SearchResult[] = []; try { const files = await readdir(cacheDir); const mdFiles = files.filter((f) => f.endsWith(".md")); for (const file of mdFiles) { const filePath = path.join(cacheDir, file); const content = await readFile(filePath, "utf-8"); // Buscar la query en el contenido (case insensitive) const lines = content.split("\n"); const matches: SearchResult["matches"] = []; lines.forEach((line, index) => { if (line.toLowerCase().includes(query.toLowerCase())) { // Agregar contexto (línea anterior y siguiente si existen) const contextLines: string[] = []; if (index > 0) contextLines.push(` ${index}: ${lines[index - 1].trim()}`); contextLines.push(`> ${index + 1}: ${line.trim()}`); if (index < lines.length - 1) contextLines.push(` ${index + 2}: ${lines[index + 1].trim()}`); matches.push({ lineNumber: index + 1, line: line.trim(), context: contextLines.join("\n"), }); } }); if (matches.length > 0) { results.push({ fileName: file .replace(".md", "") .replace("doc_", "") .replace("class_", ""), matches: matches.slice(0, 5), // Limitar a 5 coincidencias por archivo }); } } if (results.length === 0) { return `No se encontraron resultados para "${query}" en el caché local.\n\nSugerencias:\n- Verifica la ortografía\n- Intenta con términos más específicos\n- Usa las herramientas open_by_key u open_class para buscar documentación específica`; } // Formatear resultados const formattedResults: string[] = []; formattedResults.push( `Se encontraron ${results.length} archivo(s) con coincidencias para "${query}":\n` ); results.forEach((result, index) => { formattedResults.push(`## ${index + 1}. ${result.fileName}`); formattedResults.push( `Coincidencias encontradas: ${result.matches.length}\n` ); result.matches.forEach((match, matchIndex) => { formattedResults.push( `### Coincidencia ${matchIndex + 1} (Línea ${match.lineNumber})` ); if (match.context) { formattedResults.push("```"); formattedResults.push(match.context); formattedResults.push("```\n"); } }); }); return formattedResults.join("\n"); } catch (error) { return `Error al buscar en el caché: ${ error instanceof Error ? error.message : "Error desconocido" }`; } }

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/sorodriguezz/iris-mcp'

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