docs_refresh
Reconnect to SDK documentation and refresh available tools when documentation appears stale or unavailable.
Instructions
Reconnect to SDK documentation and refresh available tools. Use if docs seem stale or unavailable.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/gitbookProxy.ts:181-208 (handler)The docs_refresh tool handler implementation. Clears GitBook cache and fetches fresh tools from the GitBook MCP server, returning a success message with the list of available tools or an error message if connection fails.// Tool to refresh GitBook tools server.tool( "docs_refresh", "Reconnect to SDK documentation and refresh available tools. Use if docs seem stale or unavailable.", {}, { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, async () => { clearGitBookCache(); const tools = await fetchGitBookTools(); if (tools.length === 0) { return { content: [{ type: "text", text: `⚠️ Could not connect to docs.sodax.com\n\nThe GitBook MCP may be temporarily unavailable. Try again later or visit https://docs.sodax.com directly.` }] }; } const toolList = tools.map(t => `- \`docs_${t.name}\`: ${t.description}`).join("\n"); return { content: [{ type: "text", text: `✅ Refreshed. ${tools.length} SDK documentation tools available:\n\n${toolList}` }] }; } );
- src/services/gitbookProxy.ts:191-194 (helper)The clearGitBookCache helper function used by docs_refresh. Clears the cached tools and resets the cache timestamp to force a fresh fetch.export function clearGitBookCache(): void { cachedTools = null; toolsCacheTime = 0; }
- src/services/gitbookProxy.ts:120-148 (helper)The fetchGitBookTools helper function used by docs_refresh. Fetches available tools from the GitBook MCP server with 10-minute caching, handles initialization, and returns cached tools if still valid.export async function fetchGitBookTools(): Promise<GitBookTool[]> { // Return cached tools if still valid if (cachedTools && Date.now() - toolsCacheTime < TOOLS_CACHE_DURATION) { return cachedTools; } try { // Initialize connection first await initializeConnection(); // Fetch tools list const result = await sendMcpRequest("tools/list") as { tools: GitBookTool[] }; cachedTools = result.tools || []; toolsCacheTime = Date.now(); if (cachedTools.length > 0) { console.error(`✅ Fetched ${cachedTools.length} tools from GitBook MCP`); } else { console.error(`⚠️ GitBook MCP returned empty tools list`); } return cachedTools; } catch (error) { const errorMsg = error instanceof Error ? error.message : "unknown error"; console.error(`❌ Failed to fetch GitBook tools: ${errorMsg}`); // Return cached tools even if expired, or empty array return cachedTools || []; } }
- src/services/analytics.ts:42-42 (helper)Analytics mapping for docs_refresh to the 'sdk-docs' group for PostHog tracking.docs_refresh: "sdk-docs",
- src/tools/gitbookProxy.ts:251-259 (registration)The getGitBookToolNames function that includes docs_refresh in the list of available GitBook tool names returned by the API.export async function getGitBookToolNames(): Promise<string[]> { try { const tools = await fetchGitBookTools(); const proxyTools = tools.map(t => `docs_${t.name}`); return [...proxyTools, "docs_health", "docs_refresh", "docs_list_tools"]; } catch { return ["docs_health", "docs_refresh", "docs_list_tools"]; } }