From 802fc5339e211dcb1bbc0d44046ae7736155e781 Mon Sep 17 00:00:00 2001 From: Ajay Krishnan Date: Sat, 25 Jul 2026 09:08:28 -0700 Subject: [PATCH] Return structured content from docs tools Annotate tool returns as dict[str, Any] so FastMCP publishes an output schema and structuredContent alongside the JSON text payload. --- docker/docs/context_docs/server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/docs/context_docs/server.py b/docker/docs/context_docs/server.py index d849eb2..16c2f93 100644 --- a/docker/docs/context_docs/server.py +++ b/docker/docs/context_docs/server.py @@ -5,6 +5,7 @@ import os import re import time from contextlib import asynccontextmanager +from typing import Any from pathlib import Path import uvicorn @@ -93,7 +94,7 @@ def build_server(): merge: bool = False, sources: list[str] | None = None, hosts: list[str] | None = None, - ) -> dict: + ) -> dict[str, Any]: """Search docs. Content retrieval is explicit by default; optionally filter source URLs or hosts.""" return await service.query( query, limit, auto_retrieve, auto_retrieve_threshold, auto_retrieve_limit, @@ -105,7 +106,7 @@ def build_server(): source: str | None = None, sources: list[str] | None = None, force: bool = False, - ) -> dict: + ) -> dict[str, Any]: """Refresh configured sources transactionally; concurrent requests are coalesced.""" if source and sources: raise ValueError("pass source or sources, not both") @@ -114,7 +115,7 @@ def build_server(): return await service.refresh(sources, force) @mcp.tool() - async def docs_sources() -> dict: + async def docs_sources() -> dict[str, Any]: """Report configured-source freshness, errors, and document counts.""" return service.source_status() @@ -122,7 +123,7 @@ def build_server(): async def docs_rebuild( source: str | None = None, sources: list[str] | None = None, - ) -> dict: + ) -> dict[str, Any]: """Force a safe source rebuild without deleting the last good generation first.""" if source and sources: raise ValueError("pass source or sources, not both")