Skip to main content
Glama

search_exact

Find chemical compounds by exact SMILES match to identify synthesizable building blocks and screening compounds for research or ordering.

Instructions

Exact search by SMILES

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
smilesYes
shipToCountryNoThe country you want your order to be shipped to as two-letter country ISO code, e.g DE, US, FRUS
countNoMaximum number of results on a page
pageNoNumber of the page
categoriesNoA list of product categories to searchCSSB - In-stock building blocksCSSS - In-stock screening compoundsCSMB - Make-on-demand building blocksCSMS - Make-on-demand screening compoundsCSCS - Custom request

Implementation Reference

  • The core handler function for the 'search_exact' tool. It performs an HTTP POST request to the Chemspace API's exact search endpoint with the provided SMILES string and parameters, authenticates using a token from the manager, and returns the JSON response.
    async def search_exact( smiles: str, shipToCountry: Country = "US", count: ResultCount = 10, page: ResultPage = 1, categories: ProductCategories = ["CSSB", "CSMB"], ): """Exact search by SMILES""" access_token = await mgr.get_token() async with httpx.AsyncClient() as client: r = await client.post( url="https://api.chem-space.com/v4/search/exact", headers={ "Accept": "application/json; version=4.1", "Authorization": f"Bearer {access_token}", }, params={ "shipToCountry": shipToCountry, "count": count, "page": page, "categories": ",".join(categories), }, files={ "SMILES": (None, smiles), }, ) r.raise_for_status() data = r.json() return data
  • Type definitions using Pydantic Annotated and Field for input validation of the search_exact tool parameters (Country, ResultCount, ResultPage, ProductCategories). These are used in the function signature for schema enforcement.
    # function input types Country = Annotated[ str, Field( description="The country you want your order to be shipped to as two-letter country ISO code, e.g DE, US, FR" ), ] ResultCount = Annotated[ int, Field(description="Maximum number of results on a page", ge=1) ] ResultPage = Annotated[int, Field(description="Number of the page", ge=1)] ProductCategory = Literal["CSSB", "CSSS", "CSMB", "CSMS", "CSCS"] ProductCategories = Annotated[ List[ProductCategory], Field( description=( "A list of product categories to search" "CSSB - In-stock building blocks" "CSSS - In-stock screening compounds" "CSMB - Make-on-demand building blocks" "CSMS - Make-on-demand screening compounds" "CSCS - Custom request" ), min_length=1, ), ]
  • Imports and calls register_tools, which defines and registers the search_exact tool (along with others) to the FastMCP instance.
    from .tools import register_tools from .tokenmanager import ChemspaceTokenManager mgr = ChemspaceTokenManager() mcp = FastMCP( "Chemspace MCP", instructions="Tools for retrieving synthesizable building blocks via the Chemspace API", ) register_tools(mcp, mgr)

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/lukasmki/chemspace-mcp'

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