get_doc
Fetch full documentation page content from Google Agent Platform or Vertex AI docs. Provide the page path and optional source to get complete markdown content, retrieved live if not cached.
Instructions
Get full content of a specific documentation page.
Args: path: Documentation page path, e.g.: GEAP paths: - "models/gemini/3-1-pro" - "build/runtime/quickstart" - "scale/memory-bank/setup" - "govern/policies/overview" - "optimize/evaluation/agent-evaluation" - "agent-studio/overview" Vertex AI paths: - "multimodal/function-calling" - "rag-engine/rag-overview" - "models/gemini/2-5-flash" source: "geap" (default) or "vertex-ai"
Returns: Complete page content in Markdown format. If not cached, fetches live from the documentation site.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| source | No | geap |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The get_doc MCP tool handler: takes a documentation page path and optional source, fetches the page content (from cache or live) and returns it as Markdown. It's decorated with @mcp.tool() which registers it as an MCP tool named 'get_doc'.
@mcp.tool() async def get_doc(path: str, source: str = "geap") -> str: """Get full content of a specific documentation page. Args: path: Documentation page path, e.g.: GEAP paths: - "models/gemini/3-1-pro" - "build/runtime/quickstart" - "scale/memory-bank/setup" - "govern/policies/overview" - "optimize/evaluation/agent-evaluation" - "agent-studio/overview" Vertex AI paths: - "multimodal/function-calling" - "rag-engine/rag-overview" - "models/gemini/2-5-flash" source: "geap" (default) or "vertex-ai" Returns: Complete page content in Markdown format. If not cached, fetches live from the documentation site. """ await _ensure_initialized() src = _get_source(source) if not src: available = ", ".join(_sources.keys()) return f"❌ Unknown source '{source}'. Available: {available}" content = await _get_or_fetch_page(src, path) if content: return content return ( f"❌ Page not found: `{path}` (source: {source})\n\n" f"Try using `search_docs()` to find the correct path, " f"or `list_sections()` to browse available documentation." ) - src/mcp_google_agent_platform_docs/server.py:213-214 (registration)The @mcp.tool() decorator registers the get_doc function as an MCP tool with the FastMCP server instance, making it callable by name 'get_doc'.
@mcp.tool() async def get_doc(path: str, source: str = "geap") -> str: - Helper function used by get_doc: implements cache-first with live-fetch fallback strategy. Checks cache freshness, fetches via PageFetcher if stale/missing, saves to cache, and updates search index.
async def _get_or_fetch_page(source: Source, path: str) -> str | None: """Get a page from cache, or fetch and cache it.""" # Check cache cached = _cache.get_page(source, path) if cached and not _cache.is_stale(cached): return cached.content # Fetch live fetcher = PageFetcher(source) content = await fetcher.fetch_page(path) if content: _cache.save_page(source, path, content) # Update search index with new content _search.build_index({path: content}, source.id) return content # Fallback to stale cache if cached: logger.info("Using stale cache for %s/%s", source.id, path) return cached.content return None - Helper function used by get_doc: resolves a source ID string to a Source object, returning None if unknown.
def _get_source(source_id: str) -> Source | None: """Get a source by ID, defaulting to config.DEFAULT_SOURCE.""" if source_id in _sources: return _sources[source_id] logger.warning("Unknown source: %s", source_id) return None