Skip to main content
Glama
lukasmki

Chemspace MCP Server

by lukasmki

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)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It mentions 'exact search' which implies precision matching, but doesn't cover aspects like rate limits, authentication needs, response format, or what happens with no matches. This leaves significant gaps for a tool with 5 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words, front-loading the core purpose with zero wasted language. It's appropriately sized for a simple statement of function, though this brevity contributes to gaps in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is inadequate. It doesn't explain return values, error conditions, or how parameters interact (e.g., pagination with count/page). For a search tool with multiple configuration options, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond the schema. With 80% schema description coverage (4 out of 5 parameters have descriptions), the baseline is 3. The description doesn't compensate for the 20% gap (the 'smiles' parameter lacks schema description), nor does it provide additional context like SMILES format examples or search behavior details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Exact search by SMILES' clearly states the verb ('search') and resource ('by SMILES'), indicating it performs a precise chemical structure lookup. However, it doesn't explicitly differentiate from sibling tools like 'search_similarity' or 'search_substructure' beyond the 'exact' qualifier, which is why it doesn't reach a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of sibling tools like 'search_similarity' or 'search_substructure', nor any context about specific use cases, prerequisites, or exclusions for exact searching.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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