tooluniverse.ctg_tool module

class tooluniverse.ctg_tool.ClinicalTrialsDetailsTool(tool_config)[source]

Bases: ClinicalTrialsTool

__init__(tool_config)[source]
_extract_outcomes_from_output(study, outcome_measure)[source]
_extract_safety_from_output(study, organs, adverse_event_type)[source]
_remove_empty_values(obj)[source]
_simplify_output(study, query_type)[source]

Manually extract generally most useful information

run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

class tooluniverse.ctg_tool.ClinicalTrialsSearchTool(tool_config)[source]

Bases: ClinicalTrialsTool

__init__(tool_config)[source]
_simplify_output(response)[source]
run(arguments)[source]

Executes the search query for clinical trials.

Parameters:

arguments (dict) – A dictionary containing parameters provided by the user/LLM

Returns:

The JSON response from the API as a dictionary,

or raw text for non-JSON responses, or an error dictionary.

Return type:

dict or str

class tooluniverse.ctg_tool.ClinicalTrialsTool(tool_config)[source]

Bases: RESTfulTool

__init__(tool_config)[source]
_format_endpoint_url(arguments)[source]

Formats the endpoint URL by substituting path parameters (like {nctId}) with values from the arguments dictionary.

Parameters:

arguments (dict) – Runtime arguments provided to the tool’s run method.

Returns:

The formatted endpoint URL.

Return type:

str

_map_param_names(arguments)[source]

Maps the parameter names in the arguments dictionary to the expected parameter names defined in the tool’s JSON configuration.

Parameters:

arguments (dict) – Runtime arguments provided to the tool’s run method.

Returns:

A new dictionary with mapped parameter names.

Return type:

dict

_prepare_api_params(arguments)[source]

Prepares the dictionary of parameters for the API query string based on tool config and runtime arguments.

Parameters:

arguments (dict) – Runtime arguments provided to the tool’s run method.

Returns:

A dictionary of parameters ready for the API requests.

Return type:

dict

run(arguments)[source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.