search_blogs
Search blog posts by querying titles, content, and authors to find relevant articles from V2.ai Insights.
Instructions
Search blog posts across all content using text query. Searches titles, content, authors, and other fields.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Implementation Reference
- src/v2_ai_mcp/main.py:60-78 (handler)The underlying logic for searching blogs, which connects to the Contentful API.
def _search_blogs(query: str, limit: int = 10): """Search blog posts across all content using Contentful's search API""" if not os.getenv("CONTENTFUL_SPACE_ID") or not os.getenv("CONTENTFUL_ACCESS_TOKEN"): return { "error": "Contentful not configured. Set CONTENTFUL_SPACE_ID and CONTENTFUL_ACCESS_TOKEN environment variables." } try: from .contentful_client import ContentfulClient client = ContentfulClient() return client.search_blog_posts( query=query, content_type=os.getenv("CONTENTFUL_CONTENT_TYPE", "blogPost"), limit=limit, ) except Exception as e: return {"error": f"Error searching Contentful: {str(e)}"} - src/v2_ai_mcp/main.py:105-108 (registration)The MCP tool registration for the search_blogs tool.
@mcp.tool() def search_blogs(query: str, limit: int = 10): """Search blog posts across all content using text query. Searches titles, content, authors, and other fields.""" return _search_blogs(query, limit)