Skip to main content

Python SDK for EO Toolbelt built-in tools, MCP tools, and provider-native tool schemas

Project description

EO Toolbelt SDK

Korean documentation: README.ko.md

EO Toolbelt SDK helps Python applications expose utility tools, custom Python functions, and MCP server tools to model providers.

It gives you three small building blocks:

  • list available tool specs
  • execute a selected tool by name
  • build provider-native tool option payloads for OpenAI, Anthropic, Gemini, and Bedrock Converse

The SDK does not call a language model for you. Your application keeps the model message loop and passes tool results back using the provider's normal API format.

Install

pip install eo-toolbelt

Import package:

from mcp_tools_sdk import Tools

Quick Start

import asyncio

from mcp_tools_sdk import Tools


async def main() -> None:
    tools = Tools()

    result = await tools.call_tool(
        "safe_calculate",
        {"expression": "(12 + 8) * 3"},
    )
    print(result)


asyncio.run(main())

Build Model Tool Options

from openai import AsyncOpenAI
from mcp_tools_sdk import Tools

client = AsyncOpenAI()
tools = Tools()

tool_options = await tools.model_tool_options(
    provider="openai",
    tool_names=["safe_calculate", "get_current_datetime"],
)

response = await client.responses.create(
    model="gpt-5",
    input="What is 12 * 8, and what time is it in Seoul?",
    **tool_options,
)

If the model returns a tool call, parse the provider response, call tools.call_tool(...), then send the tool result back to the model.

Tools Constructor

tools = Tools(
    config_path="mcp_servers.json",
    timeout_seconds=30,
    custom_tools=[my_custom_tool],
)
Option Type Description
config_path `str Path
timeout_seconds `float None`
custom_tools iterable Python callables or CustomTool objects registered on this instance.
backend internal backend Alternate runtime backend for tests and advanced embedding.

Main Methods

list_tools(...)

Returns canonical tool specs.

catalog = await tools.list_tools(
    include_internal=True,
    include_mcp=True,
    include_custom=True,
    mcp_server_names=["fetch"],
    selected_tool_names=["safe_calculate"],
)

call_tool(tool_name, arguments=None)

Executes one built-in, custom, or MCP tool.

result = await tools.call_tool(
    "safe_calculate",
    {"expression": "7 * 6"},
)

MCP tools use this name format:

mcp__{server_name}__{tool_name}

model_tool_options(provider, ...)

Converts tool specs into provider-native request fields.

tool_options = await tools.model_tool_options(
    provider="bedrock",
    tool_names=["safe_calculate"],
    tool_choice={"auto": {}},
)
Provider value Returned fields
openai, gpt, openai_responses OpenAI Responses API tools and optional tool_choice.
openai_chat_completions OpenAI Chat Completions tools and optional tool_choice.
anthropic, claude Anthropic Messages tools and optional tool_choice.
gemini Gemini tools with function_declarations and optional tool_config.
bedrock, bedrock_converse Bedrock Converse toolConfig.

select_tools(query, ...)

Selects a compact tool list from a catalog. Pass an LLM callback for model-judged selection, or omit llm for the deterministic keyword fallback.

tool_names = await tools.select_tools(
    query="Calculate actual vs budget variance by department.",
    max_tools=4,
    llm=select_with_llm,
)

Custom Tools

from typing import Literal

from mcp_tools_sdk import Tools, custom_tool


def apply_discount(amount: float, rate: float = 0.1) -> dict:
    """Apply a discount rate."""
    return {"amount": amount, "rate": rate, "total": amount * (1 - rate)}


@custom_tool(name="classify_priority")
def classify_priority(level: Literal["low", "high"]) -> str:
    """Classify a priority level."""
    return level.upper()


tools = Tools(custom_tools=[apply_discount, classify_priority])

MCP Config

Pass an MCP config file when your application wants to expose MCP server tools:

tools = Tools(config_path="mcp_servers.json")

An example config is available at examples/mcp_servers.example.json.

Environment variable placeholders use this form:

${ENV_NAME}
${ENV_NAME:-default}

Credential values can also be attached to a Tools instance:

tools.configure_integration(
    "github",
    {"access_token": "github_pat_..."},
)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eo_toolbelt-0.1.0.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eo_toolbelt-0.1.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file eo_toolbelt-0.1.0.tar.gz.

File metadata

  • Download URL: eo_toolbelt-0.1.0.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for eo_toolbelt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 43f0071a4097f08d07a0e6f9a98cf4d9948581cf0a1431753bcfaa98355dd4f7
MD5 a86e10dec356326b9ff9470260a40c59
BLAKE2b-256 bca542a828081a71ee2d0fa7189b5db80e13aa3226518efdf7e130a2c3f33049

See more details on using hashes here.

File details

Details for the file eo_toolbelt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: eo_toolbelt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for eo_toolbelt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddd1ee71983a5ae21265e21d4c01fdc53ce306f3bc10c8b4c5e58fb3be37a87b
MD5 c0890d884b63805e6a1d69be46fbd097
BLAKE2b-256 fd6dcfb6d95b62403d4201cdfa744603d7a03e2ae59d5bd97954795a98bf5fee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page