tooluniverse.uspto_tool module

class tooluniverse.uspto_tool.USPTOOpenDataPortalTool[source]

Bases: BaseTool

A tool for interacting with the USPTO Open Data Portal API to search for and retrieve patent information. The run method dynamically constructs API requests based on the provided tool configuration.

__init__(tool_config, api_key=None, base_url='https://api.uspto.gov/api/v1')[source]

Initializes the USPTOOpenDataPortalTool.

Parameters:
  • tool_config – The configuration for the specific tool being run.

  • api_key – Your USPTO Open Data Portal API key.

  • base_url – The base URL for the USPTO API.

get_by_path(d, keys)[source]

Safely navigate nested dicts by a list of keys.

assign_by_path(d, path, value)[source]

Create nested dicts for a dot‑path and set the final key to value.

prune_item(item, return_fields)[source]
run(arguments)[source]

Runs the specified tool by constructing and executing an API call based on the tool’s configuration.

Parameters:

arguments – A dictionary of arguments for the tool, matching the parameters in the tool definition.

Returns:

The result of the API call, either as a dictionary (for JSON) or a string (for CSV).