Skip to main content

mercadona_tool/
lib.rs

1//! Unofficial, read-only Mercadona catalogue and product-search tools.
2//!
3//! This crate encapsulates the HTTP integration with the Mercadona online shop
4//! and its Algolia search index. It exposes product search, product details,
5//! category browsing, and postal-code-to-warehouse resolution.
6//!
7//! The integration deliberately excludes authentication, shopping-cart
8//! mutation, checkout, and order submission. Tool registration and schemas
9//! follow the conventions of the EME agent platform; authorization and
10//! execution policy remain responsibilities of agent-runtime.
11
12mod arguments;
13mod client;
14mod get_category;
15mod get_product;
16mod list_categories;
17mod resolve_postal_code;
18mod search_products;
19
20use std::path::PathBuf;
21
22use agent_config::ConfigError;
23use agent_runtime::ToolRegistry;
24
25/// Register all Mercadona catalogue tools.
26pub fn register_tools(registry: &mut ToolRegistry) -> Result<(), ConfigError> {
27    let data = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("data");
28
29    registry.register_from_file(
30        data.join("search_products.toml"),
31        search_products::SearchProducts,
32    )?;
33    registry.register_from_file(data.join("get_product.toml"), get_product::GetProduct)?;
34    registry.register_from_file(
35        data.join("list_categories.toml"),
36        list_categories::ListCategories,
37    )?;
38    registry.register_from_file(data.join("get_category.toml"), get_category::GetCategory)?;
39    registry.register_from_file(
40        data.join("resolve_postal_code.toml"),
41        resolve_postal_code::ResolvePostalCode,
42    )
43}