"""Add POSTALFORM_TOOLS to a LangChain agent; payment remains in hosted checkout."""

from typing import Any
from langchain_core.tools import tool
from postalform_client import call_tool, list_tools


@tool
async def postalform_tools() -> list[dict[str, Any]]:
    """Fetch live PostalForm tool names and input schemas before constructing arguments."""
    return await list_tools()


@tool
async def postalform_call(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
    """Call a discovery, unpaid draft or status tool. Return preview and checkout to owner."""
    return await call_tool(name, arguments)


POSTALFORM_TOOLS = [postalform_tools, postalform_call]
