Skip to main content
Glama
xytangme

NeoDB MCP Server

Official
by xytangme

search-books

Find books in NeoDB’s catalog by entering a search query. This tool helps users locate specific titles or authors within the social book cataloging service.

Instructions

Search items in catalog

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for books

Implementation Reference

  • Handler for executing the 'search-books' tool: extracts query, calls NeoDB search API, handles errors, formats and returns book search results.
    elif name == "search-books": """ https://neodb.social/developer/#/catalog/catalog_api_search_item #TBD category and page parameters not supported """ query = arguments.get("query") if not query: raise ValueError("Missing query parameter") async with httpx.AsyncClient() as client: search_data, status_code = await make_neodb_request( client, access_token, f"/api/catalog/search?query={query}&page=1", api_base ) if status_code != 200: error_message = { 400: "Bad request", }.get(status_code, f"Request failed with status code: {status_code}") return [types.TextContent(type="text", text=error_message)] if not search_data: return [types.TextContent(type="text", text=f"Failed to search books")] books = search_data.get("data", []) if not books: return [types.TextContent(type="text", text=f"No books found for query: {query}")] # Format each book into a concise string formatted_books = [format_book(book) for book in books] books_text = f"Search results for '{query}':\n\n" + "\n".join(formatted_books) return [ types.TextContent( type="text", text=books_text ) ]
  • Tool registration in list_tools(), defining name, description, and input schema requiring a 'query' string.
    types.Tool( name="search-books", description="Search items in catalog", inputSchema={ "type": "object", "properties": { "query": { "type": "string", "description": "Search query for books", } }, "required": ["query"], }, ),
  • JSON schema for 'search-books' tool input: object with required 'query' string property.
    types.Tool( name="search-books", description="Search items in catalog", inputSchema={ "type": "object", "properties": { "query": { "type": "string", "description": "Search query for books", } }, "required": ["query"], }, ),
  • Utility function to format individual book data into a multi-line string, used by search-books handler.
    def format_book(book: dict) -> str: """Format a book into a concise string.""" return ( f"Title: {book.get('title', 'Unknown')}\n" f"Author: {book.get('author', 'Unknown')}\n" f"Rating: {book.get('rating', 'N/A')}\n" f"Description: {book.get('description', 'No description available')}\n" "---" )

Other Tools

Related Tools

Latest Blog Posts

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/xytangme/neodb-mcp'

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