Fix SearchResultItem reference error for Gemini CLI
- Fixed search() function to return Dict[str, Any] instead of SearchResponse - Converted return statements to plain dictionaries - Deleted unused Pydantic models (SearchResultItem, SearchResponse) - Eliminates /SearchResultItem references that Gemini CLI cannot resolve - All MCP tools now compatible with Gemini CLI schema validation
This commit is contained in:
+23
-31
@@ -1889,18 +1889,6 @@ def get_preview_text(markdown_content: str, skip_chars: int = 100, preview_chars
|
|||||||
return preview.strip()
|
return preview.strip()
|
||||||
|
|
||||||
|
|
||||||
# Pydantic models for ChatGPT Deep Research compatibility
|
|
||||||
class SearchResultItem(BaseModel):
|
|
||||||
"""Individual search result item for Deep Research."""
|
|
||||||
id: str = Field(..., description="Document identifier")
|
|
||||||
title: str = Field(..., description="Document title with metadata")
|
|
||||||
text: str = Field(..., description="Document preview text")
|
|
||||||
url: str = Field(..., description="Document URL")
|
|
||||||
|
|
||||||
class SearchResponse(BaseModel):
|
|
||||||
"""Search response wrapper for Deep Research."""
|
|
||||||
results: List[SearchResultItem] = Field(..., description="List of search results")
|
|
||||||
|
|
||||||
@app.tool(
|
@app.tool(
|
||||||
description="DO NOT USE unless you are ChatGPT Deep Research. Search Turkish courts (Turkish keywords only). Supports: +term (must have), -term (exclude), \"exact phrase\", term1 OR term2",
|
description="DO NOT USE unless you are ChatGPT Deep Research. Search Turkish courts (Turkish keywords only). Supports: +term (must have), -term (exclude), \"exact phrase\", term1 OR term2",
|
||||||
annotations={
|
annotations={
|
||||||
@@ -1911,7 +1899,7 @@ class SearchResponse(BaseModel):
|
|||||||
)
|
)
|
||||||
async def search(
|
async def search(
|
||||||
query: str = Field(..., description="Turkish search query")
|
query: str = Field(..., description="Turkish search query")
|
||||||
) -> SearchResponse:
|
) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Bedesten API search tool for ChatGPT Deep Research compatibility.
|
Bedesten API search tool for ChatGPT Deep Research compatibility.
|
||||||
|
|
||||||
@@ -2025,29 +2013,33 @@ async def search(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
logger.info(f"ChatGPT Deep Research search completed. Found {len(results)} results via Bedesten API.")
|
logger.info(f"ChatGPT Deep Research search completed. Found {len(results)} results via Bedesten API.")
|
||||||
return SearchResponse(results=[
|
return {
|
||||||
SearchResultItem(
|
"results": [
|
||||||
id=item["id"],
|
{
|
||||||
title=item["title"],
|
"id": item["id"],
|
||||||
text=item["text"],
|
"title": item["title"],
|
||||||
url=item["url"]
|
"text": item["text"],
|
||||||
)
|
"url": item["url"]
|
||||||
for item in results
|
}
|
||||||
])
|
for item in results
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Error in ChatGPT Deep Research search tool")
|
logger.exception("Error in ChatGPT Deep Research search tool")
|
||||||
# Return partial results if any were found
|
# Return partial results if any were found
|
||||||
if results:
|
if results:
|
||||||
return SearchResponse(results=[
|
return {
|
||||||
SearchResultItem(
|
"results": [
|
||||||
id=item["id"],
|
{
|
||||||
title=item["title"],
|
"id": item["id"],
|
||||||
text=item["text"],
|
"title": item["title"],
|
||||||
url=item["url"]
|
"text": item["text"],
|
||||||
)
|
"url": item["url"]
|
||||||
for item in results
|
}
|
||||||
])
|
for item in results
|
||||||
|
]
|
||||||
|
}
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@app.tool(
|
@app.tool(
|
||||||
|
|||||||
Reference in New Issue
Block a user