Skip to main content
Glama
search.py1.39 kB
"""Search tool for ChatGPT deep research (MCP 2025-06-18 format).""" import json from config import config def format_search_results(results: list[dict]) -> dict: """Format search results for ChatGPT. Args: results: List of memory search results Returns: Dict with content array and structuredContent """ formatted_results = [ { "id": memory.get("id", ""), "title": memory.get("content", "")[:100], "url": f"{config.hydra.mcp_server_url}/memories/{memory.get('id', '')}", } for memory in results ] response_obj = {"results": formatted_results} return { "content": [{"type": "text", "text": json.dumps(response_obj)}], "structuredContent": response_obj, } # Output schema for validation SEARCH_OUTPUT_SCHEMA = { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "id": {"type": "string", "description": "Memory ID"}, "title": {"type": "string", "description": "Memory title"}, "url": {"type": "string", "description": "Memory URL"}, }, "required": ["id", "title", "url"], }, } }, "required": ["results"], }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shrijayan/SelfMemory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server