Skip to main content
Glama
liueic

PubChem Chemical Safety MCP Server

by liueic

get_toxicity_data

Retrieve toxicity data for chemical compounds from PubChem, including acute toxicity, ecotoxicity, and carcinogenicity information, using compound IDs.

Instructions

获取毒性实验数据

Args: cid: PubChem化合物ID

Returns: 包含急性毒性、生态毒性、致癌性等毒性数据的字典

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_toxicity_data', which orchestrates the call to the cache service and PubChem client to retrieve toxicity data.
    @app.tool()
    async def get_toxicity_data(ctx: Context, cid: int) -> Dict[str, Any]:
        """
        获取毒性实验数据
        
        Args:
            cid: PubChem化合物ID
            
        Returns:
            包含急性毒性、生态毒性、致癌性等毒性数据的字典
        """
        try:
            # 初始化缓存服务
            cache_service = CacheService()
            await cache_service.initialize()
            
            # 检查缓存
            cached_data = await cache_service.get_toxicity_data(cid)
            if cached_data:
                await cache_service.close()
                return {"cid": cid, **cached_data}
            
            # 从PubChem获取数据
            async with PubChemClient() as client:
                toxicity_data = await client.get_toxicity_data(cid)
                
                if "error" in toxicity_data:
                    await cache_service.close()
                    return {"cid": cid, "error": toxicity_data["error"]}
                
                # 缓存结果
                await cache_service.set_toxicity_data(cid, toxicity_data)
                await cache_service.close()
                
                return {"cid": cid, **toxicity_data}
                
        except Exception as e:
            logger.error(f"Error getting toxicity data for CID {cid}: {e}")
            return {"cid": cid, "error": str(e)}
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. It mentions the return format ('包含急性毒性、生态毒性、致癌性等毒性数据的字典' - dictionary containing acute toxicity, ecotoxicity, carcinogenicity, etc.) but doesn't address important behavioral aspects like whether this is a read-only operation, potential rate limits, authentication requirements, error conditions, or data freshness. For a data retrieval tool with zero annotation coverage, this leaves significant gaps.

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

Conciseness4/5

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

The description is appropriately concise with three clear sections: purpose statement, parameter documentation, and return value description. Each sentence earns its place by providing essential information. The structure with labeled 'Args:' and 'Returns:' sections is helpful, though the formatting could be more consistent.

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

Completeness3/5

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

Given the tool has an output schema (which presumably documents the return structure), the description doesn't need to fully explain return values. However, for a toxicity data retrieval tool with no annotations and only basic parameter documentation, the description should provide more context about data sources, limitations, or typical use cases. It's minimally adequate but leaves important questions unanswered.

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 explicitly documents the single parameter 'cid' as 'PubChem化合物ID' (PubChem compound ID), which adds crucial semantic meaning beyond the schema's generic 'Cid' title and integer type. With 0% schema description coverage, this parameter documentation is essential. However, it doesn't provide format examples, valid ranges, or handling of invalid inputs.

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 clearly states the tool's purpose as '获取毒性实验数据' (get toxicity experiment data), which is a specific verb+resource combination. It distinguishes from sibling tools like 'get_compound_info' and 'get_safety_info' by focusing specifically on toxicity data. However, it doesn't explicitly differentiate itself from 'get_safety_info' which might overlap in scope.

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 like 'get_safety_info'. There's no mention of prerequisites, appropriate contexts, or exclusions. The only implied usage is when toxicity data for a specific compound is needed, but this is too vague for effective tool selection.

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/liueic/PubChem-MCP-Server'

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