Skip to main content
Glama

get_substance_safety_assessment

Retrieve safety assessment data from EFSA opinions to evaluate mutagenic, genotoxic, and carcinogenic risks for food substances using SUB_COM_ID identifiers.

Instructions

Get comprehensive safety assessment data for a substance by SUB_COM_ID.

Retrieves safety flags (mutagenic, genotoxic, carcinogenic) and assessment metadata
from EFSA opinions, sorted chronologically by publication date. This tool provides
the core safety information used by EFSA to evaluate food safety risks.

Args:
    sub_com_id (int): The SUB_COM_ID identifier for the substance component.
                      Use search_substance tool first to find the SUB_COM_ID for a
                      given substance name or E-number.

Returns:
    JSON string containing a DataFrame with safety assessment records. Each record
    includes safety flags, classification, opinion metadata, and publication dates.
    Results are sorted chronologically (oldest to newest) by PUBLICATIONDATE.

The returned data includes:
- Safety flags: IS_MUTAGENIC, IS_GENOTOXIC, IS_CARCINOGENIC
- Classification: SUB_OP_CLASS (e.g., food additive, pesticide, flavoring)
- Study details: REMARKS_STUDY, TOXREF_ID
- Opinion metadata: OP_ID, AUTHOR, TITLE, ADOPTIONDATE, PUBLICATIONDATE

Note: Multiple records may be returned if the substance has been assessed in
multiple EFSA opinions over time. Review the chronological order to see how
safety assessments have evolved.

<dictionary_descriptions>
<name>OP_ID</name>
<description>Unique identifier links to the OPINION table</description>
<name>IS_GENOTOXIC</name>
<description>Indicates whether the substance is genotoxic or not according to the assessment provided in the opinion. The Not applicable notation is used in case of group substances</description>
<name>SUB_OP_CLASS</name>
<description>Indicates the class of the substance and the corresponding opinion as provided by EFSA</description>
<name>IS_MUTAGENIC</name>
<description>Indicates whether the substance is mutagenic or not according to the assessment provided in the opinion.  The "Not applicable" notation is used in case of group substances</description>
<name>IS_CARCINOGENIC</name>
<description>Indicates whether the substance is carcinogenic or not according to the assessment provided in the opinion. The Not applicable notation is used in case of group substances</description>
<name>REMARKS_STUDY</name>
<description>Indicates the objective of the opinion and report any general remark as retrieved from the opinion</description>
<name>TOXREF_ID</name>
<description>Unique identifier links to the ENDPOINTSTUDY table for groups</description>
<name>AUTHOR</name>
<description>Indicates the author/s of the publication</description>
<name>TITLE</name>
<description>Indicates the title of the publication</description>
<name>ADOPTIONDATE</name>
<description>Complete date of the adoption of the document in the format yyyymmdd</description>
<name>PUBLICATIONDATE</name>
<description>Complete date of the publication of the document in the format yyyymmdd</description>
</dictionary_descriptions>

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sub_com_idYes

Implementation Reference

  • The main handler function that defines and implements the 'get_substance_safety_assessment' tool. It calls the database query helper and returns the result as JSON.
    def get_substance_safety_assessment(sub_com_id):
        """
        Get comprehensive safety assessment data for a substance by SUB_COM_ID.
    
        Retrieves safety flags (mutagenic, genotoxic, carcinogenic) and assessment metadata
        from EFSA opinions, sorted chronologically by publication date. This tool provides
        the core safety information used by EFSA to evaluate food safety risks.
    
        Args:
            sub_com_id (int): The SUB_COM_ID identifier for the substance component.
                              Use search_substance tool first to find the SUB_COM_ID for a
                              given substance name or E-number.
    
        Returns:
            JSON string containing a DataFrame with safety assessment records. Each record
            includes safety flags, classification, opinion metadata, and publication dates.
            Results are sorted chronologically (oldest to newest) by PUBLICATIONDATE.
    
        The returned data includes:
        - Safety flags: IS_MUTAGENIC, IS_GENOTOXIC, IS_CARCINOGENIC
        - Classification: SUB_OP_CLASS (e.g., food additive, pesticide, flavoring)
        - Study details: REMARKS_STUDY, TOXREF_ID
        - Opinion metadata: OP_ID, AUTHOR, TITLE, ADOPTIONDATE, PUBLICATIONDATE
    
        Note: Multiple records may be returned if the substance has been assessed in
        multiple EFSA opinions over time. Review the chronological order to see how
        safety assessments have evolved.
    
        <dictionary_descriptions>
        <name>OP_ID</name>
        <description>Unique identifier links to the OPINION table</description>
        <name>IS_GENOTOXIC</name>
        <description>Indicates whether the substance is genotoxic or not according to the assessment provided in the opinion. The Not applicable notation is used in case of group substances</description>
        <name>SUB_OP_CLASS</name>
        <description>Indicates the class of the substance and the corresponding opinion as provided by EFSA</description>
        <name>IS_MUTAGENIC</name>
        <description>Indicates whether the substance is mutagenic or not according to the assessment provided in the opinion.  The "Not applicable" notation is used in case of group substances</description>
        <name>IS_CARCINOGENIC</name>
        <description>Indicates whether the substance is carcinogenic or not according to the assessment provided in the opinion. The Not applicable notation is used in case of group substances</description>
        <name>REMARKS_STUDY</name>
        <description>Indicates the objective of the opinion and report any general remark as retrieved from the opinion</description>
        <name>TOXREF_ID</name>
        <description>Unique identifier links to the ENDPOINTSTUDY table for groups</description>
        <name>AUTHOR</name>
        <description>Indicates the author/s of the publication</description>
        <name>TITLE</name>
        <description>Indicates the title of the publication</description>
        <name>ADOPTIONDATE</name>
        <description>Complete date of the adoption of the document in the format yyyymmdd</description>
        <name>PUBLICATIONDATE</name>
        <description>Complete date of the publication of the document in the format yyyymmdd</description>
        </dictionary_descriptions>
        """
        df = query_safety_assessment(sub_com_id)
        return df.to_json()
  • main.py:23-23 (registration)
    Registers the get_substance_safety_assessment tool with the FastMCP server.
    mcp.add_tool(get_substance_safety_assessment)
  • Supporting database query function that retrieves the safety assessment data from the database, used by the tool handler.
    def query_safety_assessment(sub_com_id) -> DataFrame:
        """
        Get the safety assessment for a given SUB_COM_ID.
        Returns safety assessment fields from the STUDY table, joined with OPINION for dates and metadata.
        Results are sorted chronologically by PUBLICATIONDATE.
        """
        with get_connection() as db_connection:
            safety_assessment = pd.read_sql_query(
                """
                SELECT 
                    s.SUB_OP_CLASS,
                    s.IS_MUTAGENIC,
                    s.IS_GENOTOXIC,
                    s.IS_CARCINOGENIC,
                    s.REMARKS_STUDY,
                    s.TOXREF_ID,
                    s.OP_ID,
                    o.ADOPTIONDATE,
                    o.PUBLICATIONDATE,
                    o.AUTHOR,
                    o.TITLE
                FROM study s
                LEFT JOIN opinion o ON s.OP_ID = o.OP_ID
                WHERE s.SUB_COM_ID = ?
                ORDER BY o.PUBLICATIONDATE ASC
                """,
                db_connection,
                params=[sub_com_id],
            )
            return safety_assessment
Behavior4/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 effectively describes the tool's behavior: retrieving safety assessment data, sorting chronologically, returning JSON with DataFrame structure, and handling multiple records for substances assessed over time. It covers the core functionality well, though it doesn't mention potential limitations like rate limits, error conditions, or data freshness.

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 well-structured with clear sections: purpose statement, parameter guidance, return format explanation, and field descriptions. While comprehensive, it could be more concise by integrating the dictionary_descriptions more efficiently rather than listing them separately. The core information is front-loaded effectively.

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

Completeness5/5

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

Given the complexity of safety assessment data, no annotations, and no output schema, the description provides excellent completeness. It explains what data is returned, the structure (JSON DataFrame), sorting behavior, field meanings, and the possibility of multiple records. The dictionary_descriptions section provides detailed field semantics, making this description self-contained despite the lack of structured metadata.

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

Parameters5/5

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

With 0% schema description coverage (the schema only shows 'sub_com_id' as a string type without description), the description fully compensates by explaining the parameter's purpose: 'The SUB_COM_ID identifier for the substance component' and providing guidance on how to obtain it via the search_substance tool. This adds crucial semantic meaning beyond the bare schema.

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

Purpose5/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: 'Get comprehensive safety assessment data for a substance by SUB_COM_ID' with specific details about retrieving safety flags and assessment metadata from EFSA opinions. It distinguishes from siblings by specifying this is for safety assessment data, unlike tools like 'search_substance' (for finding IDs) or 'get_toxicity_endpoints' (for different data types).

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'Use search_substance tool first to find the SUB_COM_ID for a given substance name or E-number.' This clearly establishes a prerequisite workflow and distinguishes it from the search_substance sibling tool. The description also explains when multiple records are returned, helping users understand the output context.

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/spyrosze/mcp-openfoodtox'

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