fetchFullContent
Retrieves complete content from preview search results to access full articles, documents, or web pages in markdown, text, or HTML formats.
Instructions
Busca conteúdo completo de um resultado anterior de RAG obtido em contentMode=preview
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contentHandle | Yes | Handle do conteúdo obtido em contentMode=preview da ferramenta rag | |
| outputFormat | No | Formato de saída do conteúdo | markdown |
Implementation Reference
- src/tools/fetch.ts:19-61 (handler)Core execution logic for the fetchFullContent tool. Decodes the content handle to retrieve URL, fetches from cache, handles errors, and returns formatted content based on outputFormat.export async function fetchFullContent( params: FetchFullContentParams ): Promise<FetchResult> { const { contentHandle, outputFormat = "markdown" } = params; const url = decodeContentHandle(contentHandle); if (!url) { return { url: "", title: "", error: "Invalid contentHandle format. Ensure it was generated by rag() tool.", }; } const cached = getFromCache(url); if (!cached) { return { url, title: "", error: `Content not found in cache. Cache TTL is 1 hour. Please run rag() again to re-fetch and cache the content.`, }; } const result: FetchResult = { url: cached.url, title: cached.title, cached: true, contentLength: outputFormat === "markdown" ? cached.markdown.length : cached.content.length, }; if (outputFormat === "markdown") { result.markdown = cached.markdown; } else if (outputFormat === "text") { result.text = cached.content; } else if (outputFormat === "html") { result.html = cached.content; } return result; }
- src/index.ts:61-80 (registration)MCP server tool registration for 'fetchFullContent', including description, Zod input schema, and wrapper handler that invokes the core fetchFullContent function and formats the MCP response.server.tool( "fetchFullContent", "Busca conteúdo completo de um resultado anterior de RAG obtido em contentMode=preview", { contentHandle: z .string() .min(1) .describe("Handle do conteúdo obtido em contentMode=preview da ferramenta rag"), outputFormat: z .enum(["markdown", "text", "html"]) .default("markdown") .describe("Formato de saída do conteúdo"), }, async (params) => { const result = await fetchFullContent(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } );
- src/tools/fetch.ts:8-17 (schema)TypeScript interface defining the output structure of the fetchFullContent function.interface FetchResult { url: string; title: string; markdown?: string; text?: string; html?: string; contentLength?: number; cached?: boolean; error?: string; }
- src/tools/fetch.ts:3-6 (schema)TypeScript interface defining the input parameters for the fetchFullContent function.interface FetchFullContentParams { contentHandle: string; outputFormat?: "markdown" | "text" | "html"; }
- src/index.ts:64-73 (schema)Zod schema defining the input validation for the MCP tool registration.{ contentHandle: z .string() .min(1) .describe("Handle do conteúdo obtido em contentMode=preview da ferramenta rag"), outputFormat: z .enum(["markdown", "text", "html"]) .default("markdown") .describe("Formato de saída do conteúdo"), },