Skip to content

Exceptions

Errors raised by the gllm-tools tool layers: the code interpreter tool and the MCP client.

Every error is a gllm-core BaseError with a GLLM-TOOL-* code. The sandbox layer has its own GL-SBX-* errors in gllm_tools.code_interpreter.errors.

BaseToolsError(message=None, *, debug_info=None, recovery=None, original_error=None)

Bases: BaseError

Root of the GLLM-TOOL-* errors raised by the code interpreter tool and the MCP client.

MCPConfigError(message=None, *, debug_info=None, recovery=None, original_error=None)

Bases: BaseToolsError, ValueError

Raised when the MCP server configuration is missing, invalid, or names an unknown server.

Attributes:

Name Type Description
code str

Stable error code, GLLM-TOOL-MCP-CONFIG.

default_message str

Default message, "The MCP server configuration is invalid. ..."

MCPResourceError(message=None, *, debug_info=None, recovery=None, original_error=None)

Bases: BaseToolsError, ValueError

Raised when an MCP server returns resource content the client cannot read.

Attributes:

Name Type Description
code str

Stable error code, GLLM-TOOL-MCP-RESOURCE.

default_message str

Default message, "The MCP resource content is not supported. ..."

MCPToolCallError(content)

Bases: BaseToolsError, ToolException

Raised when an MCP tool call returns an error result.

It stays a LangChain ToolException, so a tool's handle_tool_error still catches it. As before, args[0] and str() hold the tool's error content unchanged, because handle_tool_error=True returns args[0] to the model.

Attributes:

Name Type Description
code str

Stable error code, GLLM-TOOL-MCP-TOOL-CALL.

default_message str

Default message, "The MCP tool call failed. ..."

Initialize the error with the tool's error content.

Parameters:

Name Type Description Default
content str | list[str]

The text content of the failed tool result.

required

__str__()

Returns the tool's error content, as ToolException did.

Returns:

Name Type Description
str str

The error content.

ToolsTypeError(message=None, *, debug_info=None, recovery=None, original_error=None)

Bases: BaseToolsError, TypeError

Raised when a value passed to a tool component has an unsupported type.

Attributes:

Name Type Description
code str

Stable error code, GLLM-TOOL-TYPE.

default_message str

Default message, "The value has an unsupported type. ..."