Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(tools): add comprehensive test coverage for tool registry and URL validation

Steven Enamakelea0ae869229d
diff --git a/crates/openhuman-core/src/mcp/server/tools_tests_part_01_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_params_and_specs_tests.rs
similarity index 100%
rename from crates/openhuman-core/src/mcp/server/tools_tests_part_01_tests.rs
rename to crates/openhuman-core/src/mcp/server/tools_tests_params_and_specs_tests.rs
diff --git a/crates/openhuman-core/src/mcp/server/tools_tests_part_02_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_tag_and_dispatch_tests.rs
similarity index 100%
rename from crates/openhuman-core/src/mcp/server/tools_tests_part_02_tests.rs
rename to crates/openhuman-core/src/mcp/server/tools_tests_tag_and_dispatch_tests.rs
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index cd6bda2b7f..81eb2ced71 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -35,4 +35,34 @@
mod tests;
mod records_docs_wallet;
-mod records_マcp_connectors_placeholder; // removed below
+mod records_mcp_connectors;
+mod records_memory_juice;
+mod records_runtime;
+mod records_voice;
+
+use crate::modules::types::ModuleRecord;
+use records_docs_wallet::{TINYDOCS, TINYWALLET};
+use records_mcp_connectors::{TINYCONNECTORS, TINYMCP};
+use records_memory_juice::{TINYJUICE, TINYMEMORY};
+use records_runtime::{TINYRUNTIME, TINYRUNTIME_NODEJS, TINYRUNTIME_PYTHON};
+use records_voice::TINYVOICE;
+
+/// Every module this build can load.
+pub const ALL: &[ModuleRecord] = &[
+ TINYDOCS,
+ TINYWALLET,
+ TINYMEMORY,
+ TINYJUICE,
+ TINYVOICE,
+ TINYRUNTIME,
+ TINYRUNTIME_NODEJS,
+ TINYRUNTIME_PYTHON,
+ TINYMCP,
+ TINYCONNECTORS,
+];
+
+/// The record for `id`, if this build knows it.
+#[must_use]
+pub fn find(id: &str) -> Option<&'static ModuleRecord> {
+ ALL.iter().find(|record| record.id == id)
+}
diff --git a/crates/openhuman-core/src/skills/ops_install/url_validation.rs b/crates/openhuman-core/src/skills/ops_install/url_validation.rs
new file mode 100644
index 0000000000..c51e996ec2
--- /dev/null
+++ b/crates/openhuman-core/src/skills/ops_install/url_validation.rs
@@ -0,0 +1,275 @@
+//! URL normalization and SSRF-safety validation for skill install URLs.
+
+use super::super::ops_types::{WorkflowFrontmatter, MAX_NAME_LEN};
+
+/// Upper bound on raw URL length accepted by [`validate_install_url`].
+pub const MAX_INSTALL_URL_LEN: usize = 2048;
+const ALLOW_LOCAL_HTTP_ENV: &str = "OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP";
+
+/// Rewrite `github.com/<o>/<r>/blob/<branch>/<path>` into its raw counterpart
+/// so a URL copied from a browser's GitHub page resolves to the file body
+/// instead of the HTML wrapper. Any other host is returned unchanged.
+///
+/// Also enforces that the final path ends in `.md` (case-insensitive). Tree,
+/// commit, and whole-repo URLs are rejected here — they require a
+/// fundamentally different install path (recursive fetch / tarball) that is
+/// out of scope for single-file SKILL.md installs.
+pub(crate) fn normalize_install_url(raw: &str) -> Result<String, String> {
+ let parsed =
+ url::Url::parse(raw).map_err(|e| format!("unsupported url form: parse {raw:?}: {e}"))?;
+ let host = parsed.host_str().unwrap_or("").to_ascii_lowercase();
+
+ let normalized = if host == "github.com" {
+ let segments: Vec<&str> = parsed
+ .path_segments()
+ .map(|it| it.collect())
+ .unwrap_or_default();
+ if segments.len() >= 5 && segments[2] == "blob" {
+ let owner = segments[0];
+ let repo = segments[1];
+ let branch = segments[3];
+ let rest = segments[4..].join("/");
+ format!("https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{rest}")
+ } else if segments.len() >= 3 && (segments[2] == "tree" || segments[2] == "raw") {
+ return Err(format!(
+ "unsupported url form: only direct SKILL.md links are supported, got {raw:?} (tree/dir URLs are not yet supported)"
+ ));
+ } else if segments.len() <= 2 {
+ return Err(format!(
+ "unsupported url form: only direct SKILL.md links are supported, got {raw:?} (whole-repo URLs are not yet supported)"
+ ));
+ } else {
+ raw.to_string()
+ }
+ } else {
+ raw.to_string()
+ };
+
+ let check = url::Url::parse(&normalized)
+ .map_err(|e| format!("unsupported url form: parse normalized {normalized:?}: {e}"))?;
+ let path_lower = check.path().to_ascii_lowercase();
+ if !path_lower.ends_with(".md") {
+ return Err(format!(
+ "unsupported url form: path must end in .md, got {normalized:?}"
+ ));
+ }
+
+ Ok(normalized)
+}
+
+/// Derive the install directory slug from the SKILL.md frontmatter.
+///
+/// Prefers `metadata.id` (the spec-aligned identifier) when present. Falls
+/// back to a sanitized form of `name`:
+/// * lowercase ASCII
+/// * non-alphanumeric runs collapsed to a single `-`
+/// * leading/trailing `-` trimmed
+///
+/// Rejects the empty string and paths that would escape the skills root
+/// (`..`, `/`, `\`). Max length is [`MAX_NAME_LEN`].
+pub(crate) fn derive_install_slug(fm: &WorkflowFrontmatter) -> Result<String, String> {
+ let candidate = fm
+ .metadata
+ .get("id")
+ .and_then(|v| v.as_str())
+ .map(|s| s.to_string())
+ .unwrap_or_else(|| fm.name.clone());
+
+ let mut out = String::with_capacity(candidate.len());
+ let mut last_dash = false;
+ for ch in candidate.chars() {
+ if ch.is_ascii_alphanumeric() {
+ out.push(ch.to_ascii_lowercase());
+ last_dash = false;
+ } else if !last_dash && !out.is_empty() {
+ out.push('-');
+ last_dash = true;
+ }
+ }
+ while out.ends_with('-') {
+ out.pop();
+ }
+
+ if out.is_empty() {
+ return Err(
+ "invalid SKILL.md: cannot derive slug from empty name/id — set a value in frontmatter"
+ .to_string(),
+ );
+ }
+ if out.len() > MAX_NAME_LEN {
+ return Err(format!(
+ "invalid SKILL.md: derived slug {out:?} exceeds {MAX_NAME_LEN} chars"
+ ));
+ }
+ if out.contains("..") || out.contains('/') || out.contains('\\') {
+ return Err(format!(
+ "invalid SKILL.md: derived slug {out:?} contains forbidden path components"
+ ));
+ }
+
+ Ok(out)
+}
+
+/// Validate a remote skill install URL. Returns `Ok(())` when the URL is
+/// well-formed, uses `https`, and points at a public host.
+///
+/// Rejects:
+/// * empty string or > [`MAX_INSTALL_URL_LEN`] bytes
+/// * non-`https` schemes (including `http`, `ftp`, `file`, `git+ssh`)
+/// * missing or empty host
+/// * `localhost`, `*.localhost`, `*.local`
+/// * IPv4 literals in loopback (127.0.0.0/8), private (10/8, 172.16/12,
+/// 192.168/16), link-local (169.254/16), shared-address (100.64/10),
+/// multicast, broadcast, or unspecified (0.0.0.0) ranges
+/// * IPv6 literals in loopback (::1), unspecified (::), unique-local
+/// (fc00::/7), link-local (fe80::/10), or multicast (ff00::/8)
+pub fn validate_install_url(raw: &str) -> Result<(), String> {
+ validate_install_url_with_config(raw, read_allow_local_http_env())
+}
+
+/// Same as [`validate_install_url`] but takes an explicit `allow_local_http`
+/// flag instead of reading `OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP` from the
+/// process environment. Callers below the public entry point should always use
+/// this variant — the env-var read in `validate_install_url` is racy across
+/// threads under the parallel test runner (#4567), and the escape hatch is
+/// only meaningful at a single boundary.
+pub(crate) fn validate_install_url_with_config(
+ raw: &str,
+ allow_local_http: bool,
+) -> Result<(), String> {
+ let trimmed = raw.trim();
+ if trimmed.is_empty() {
+ return Err("url must not be empty".to_string());
+ }
+ if trimmed.len() > MAX_INSTALL_URL_LEN {
+ return Err(format!(
+ "url exceeds max {MAX_INSTALL_URL_LEN} chars (got {})",
+ trimmed.len()
+ ));
+ }
+ let parsed = url::Url::parse(trimmed).map_err(|e| format!("invalid url {trimmed:?}: {e}"))?;
+ if parsed.scheme() != "https" {
+ if allow_local_http && is_loopback_http_url(trimmed) {
+ return Ok(());
+ }
+ return Err(format!(
+ "url scheme {:?} not allowed; https only",
+ parsed.scheme()
+ ));
+ }
+ let host = parsed
+ .host_str()
+ .ok_or_else(|| format!("url {trimmed:?} has no host"))?;
+ if host.is_empty() {
+ return Err(format!("url {trimmed:?} has empty host"));
+ }
+ if is_blocked_install_host(host) {
+ return Err(format!(
+ "host {host:?} not allowed (loopback/private/link-local/multicast)"
+ ));
+ }
+ Ok(())
+}
+
+/// Reads the local-HTTP install escape hatch env var. Kept as the single
+/// boundary point where env is inspected so downstream validation never
+/// touches process-global state — required to stop the parallel-test race
+/// described in #4567.
+pub(super) fn read_allow_local_http_env() -> bool {
+ std::env::var(ALLOW_LOCAL_HTTP_ENV).ok().as_deref() == Some("1")
+}
+
+pub(super) fn is_loopback_http_url(raw: &str) -> bool {
+ let Ok(parsed) = url::Url::parse(raw) else {
+ return false;
+ };
+ if parsed.scheme() != "http" {
+ return false;
+ }
+ let Some(host) = parsed.host_str() else {
+ return false;
+ };
+ matches!(host, "localhost" | "127.0.0.1" | "::1")
+}
+
+/// Resolve the host in the given URL and reject if any returned IP falls in
+/// loopback / private / link-local / multicast / unspecified ranges.
+///
+/// Covers the DNS-to-private-IP SSRF vector: a public-looking hostname can
+/// still resolve to 127.0.0.1 / 169.254.x / fc00::/7 etc., which
+/// [`validate_install_url`] alone cannot detect because it only inspects
+/// literal IP hosts.
+///
+/// Caveat: does **not** close the DNS-rebinding gap. `reqwest` performs its
+/// own DNS lookup on the GET below, and a rebinding server can answer the
+/// check with a public IP and answer reqwest with a private one. Full
+/// mitigation requires resolving to a `SocketAddr` here and passing it to
+/// reqwest via a custom resolver that only honours the pinned address.
+pub async fn validate_resolved_host(raw_url: &str) -> Result<(), String> {
+ let parsed = url::Url::parse(raw_url)
+ .map_err(|e| format!("invalid url {raw_url:?} during DNS guard: {e}"))?;
+ let host = parsed
+ .host_str()
+ .ok_or_else(|| format!("url {raw_url:?} has no host (DNS guard)"))?;
+ // `tokio::net::lookup_host` wants "host:port". Default https → 443.
+ let port = parsed.port_or_known_default().unwrap_or(443);
+ // IPv6 literal hosts come back bracketed from `url::Url`; `lookup_host`
+ // needs the bracketed form for IPv6 to parse correctly.
+ let lookup_target = if parsed
+ .host()
+ .map(|h| matches!(h, url::Host::Ipv6(_)))
+ .unwrap_or(false)
+ {
+ format!("[{host}]:{port}")
+ } else {
+ format!("{host}:{port}")
+ };
+
+ tracing::debug!(
+ host = %host,
+ port = port,
+ "[skills] validate_resolved_host: resolving"
+ );
+
+ let mut addrs = tokio::net::lookup_host(&lookup_target)
+ .await
+ .map_err(|e| format!("dns lookup failed for {host:?}: {e}"))?
+ .peekable();
+ if addrs.peek().is_none() {
+ return Err(format!("host {host:?} resolved to no IP addresses"));
+ }
+ for addr in addrs {
+ let ip = addr.ip();
+ match ip {
+ std::net::IpAddr::V4(v4) => {
+ if crate::tools::is_non_global_v4(v4) {
+ tracing::warn!(
+ host = %host,
+ resolved = %v4,
+ "[skills] validate_resolved_host: rejected private IPv4"
+ );
+ return Err(format!(
+ "host {host:?} resolved to non-public IPv4 {v4} (loopback/private/link-local)"
+ ));
+ }
+ }
+ std::net::IpAddr::V6(v6) => {
+ if crate::tools::is_non_global_v6(v6) {
+ tracing::warn!(
+ host = %host,
+ resolved = %v6,
+ "[skills] validate_resolved_host: rejected private IPv6"
+ );
+ return Err(format!(
+ "host {host:?} resolved to non-public IPv6 {v6} (loopback/ula/link-local)"
+ ));
+ }
+ }
+ }
+ }
+ Ok(())
+}
+
+fn is_blocked_install_host(host: &str) -> bool {
+ crate::tools::is_private_or_local_host(host)
+}
diff --git a/crates/openhuman-core/src/tools/schemas/registry.rs b/crates/openhuman-core/src/tools/schemas/registry.rs
new file mode 100644
index 0000000000..1bed265984
--- /dev/null
+++ b/crates/openhuman-core/src/tools/schemas/registry.rs
@@ -0,0 +1,387 @@
+//! Controller schema definitions and dispatch table for the `tools` namespace.
+//!
+//! [`all_controller_schemas`] and [`all_registered_controllers`] enumerate the
+//! small allowlist of tool-like operations exposed over JSON-RPC (see the module
+//! doc on `super`). [`tools_schemas`] is the schema lookup shared by both.
+
+use serde_json::{json, Map, Value};
+
+use crate::core::all::{ControllerFuture, RegisteredController};
+use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
+
+use super::apify::handle_apify_linkedin_scrape;
+use super::composio::handle_composio_execute;
+use super::web_search::{
+ handle_querit_search, handle_searxng_search, handle_seltz_search, handle_web_search,
+};
+
+pub fn all_controller_schemas() -> Vec<ControllerSchema> {
+ vec![
+ tools_schemas("tools_composio_execute"),
+ tools_schemas("tools_web_search"),
+ tools_schemas("tools_seltz_search"),
+ tools_schemas("tools_querit_search"),
+ tools_schemas("tools_searxng_search"),
+ tools_schemas("tools_apify_linkedin_scrape"),
+ ]
+}
+
+pub fn all_registered_controllers() -> Vec<RegisteredController> {
+ vec![
+ RegisteredController {
+ schema: tools_schemas("tools_composio_execute"),
+ handler: handle_composio_execute,
+ },
+ RegisteredController {
+ schema: tools_schemas("tools_web_search"),
+ handler: handle_web_search,
+ },
+ RegisteredController {
+ schema: tools_schemas("tools_seltz_search"),
+ handler: handle_seltz_search,
+ },
+ RegisteredController {
+ schema: tools_schemas("tools_querit_search"),
+ handler: handle_querit_search,
+ },
+ RegisteredController {
+ schema: tools_schemas("tools_searxng_search"),
+ handler: handle_searxng_search,
+ },
+ RegisteredController {
+ schema: tools_schemas("tools_apify_linkedin_scrape"),
+ handler: handle_apify_linkedin_scrape,
+ },
+ ]
+}
+
+pub fn tools_schemas(function: &str) -> ControllerSchema {
+ match function {
+ "tools_composio_execute" => ControllerSchema {
+ namespace: "tools",
+ function: "composio_execute",
+ description: "Execute a Composio action. Routes through the mode-aware \
+ factory: backend mode proxies via the OpenHuman backend; \
+ direct mode calls backend.composio.dev with the user's own \
+ API key. Exposed for Tauri-driven flows (e.g. onboarding) \
+ that orchestrate tool calls themselves.",
+ inputs: vec![
+ FieldSchema {
+ name: "action",
+ ty: TypeSchema::String,
+ comment: "Composio action slug (e.g. `GMAIL_FETCH_EMAILS`).",
+ required: true,
+ },
+ FieldSchema {
+ name: "params",
+ ty: TypeSchema::Json,
+ comment: "Action parameters object passed straight through to Composio.",
+ required: false,
+ },
+ ],
+ outputs: vec![
+ FieldSchema {
+ name: "successful",
+ ty: TypeSchema::Bool,
+ comment: "Whether the upstream provider reported success.",
+ required: true,
+ },
+ FieldSchema {
+ name: "data",
+ ty: TypeSchema::Json,
+ comment: "Raw provider response.",
+ required: true,
+ },
+ FieldSchema {
+ name: "error",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Provider error message if `successful` is false.",
+ required: false,
+ },
+ ],
+ },
+ "tools_web_search" => ControllerSchema {
+ namespace: "tools",
+ function: "web_search",
+ description: "Web search via the backend Parallel proxy. Returns structured \
+ results so callers can inspect titles, URLs, and excerpts \
+ without parsing the agent-facing pretty text.",
+ inputs: vec![
+ FieldSchema {
+ name: "query",
+ ty: TypeSchema::String,
+ comment: "Search query string.",
+ required: true,
+ },
+ FieldSchema {
+ name: "objective",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Optional objective sent to Parallel (defaults to `query`).",
+ required: false,
+ },
+ FieldSchema {
+ name: "max_results",
+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ comment: "Max results (1-10, default 5).",
+ required: false,
+ },
+ FieldSchema {
+ name: "timeout_secs",
+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ comment: "Request timeout in seconds (default 15).",
+ required: false,
+ },
+ ],
+ outputs: vec![
+ FieldSchema {
+ name: "results",
+ ty: TypeSchema::Array(Box::new(TypeSchema::Json)),
+ comment: "Each item: {url, title, publish_date?, excerpts[]}.",
+ required: true,
+ },
+ FieldSchema {
+ name: "provider",
+ ty: TypeSchema::String,
+ comment: "Upstream provider the managed backend resolved this \
+ search to, for attribution. Reported by the backend when \
+ it names one; falls back to the managed default.",
+ required: true,
+ },
+ ],
+ },
+ "tools_seltz_search" => ControllerSchema {
+ namespace: "tools",
+ function: "seltz_search",
+ description: "Web search via the Seltz API. Returns structured results with \
+ URLs, content, and optional published dates. Supports domain \
+ filtering, date ranges, and news scope.",
+ inputs: vec![
+ FieldSchema {
+ name: "query",
+ ty: TypeSchema::String,
+ comment: "Search query string.",
+ required: true,
+ },
+ FieldSchema {
+ name: "max_results",
+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ comment: "Max results (1-20, default 10).",
+ required: false,
+ },
+ FieldSchema {
+ name: "include_domains",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::String,
+ )))),
+ comment: "Restrict results to these domains.",
+ required: false,
+ },
+ FieldSchema {
+ name: "exclude_domains",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::String,
+ )))),
+ comment: "Exclude results from these domains.",
+ required: false,
+ },
+ FieldSchema {
+ name: "from_date",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Only results published on or after (YYYY-MM-DD).",
+ required: false,
+ },
+ FieldSchema {
+ name: "to_date",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Only results published on or before (YYYY-MM-DD).",
+ required: false,
+ },
+ FieldSchema {
+ name: "scope",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Restrict to a scope, e.g. \"news\".",
+ required: false,
+ },
+ ],
+ outputs: vec![FieldSchema {
+ name: "documents",
+ ty: TypeSchema::Array(Box::new(TypeSchema::Json)),
+ comment: "Each item: {url, content, title?, published_date?}.",
+ required: true,
+ }],
+ },
+ "tools_querit_search" => ControllerSchema {
+ namespace: "tools",
+ function: "querit_search",
+ description: "Web search via the Querit API. Returns current results with URLs, \
+ snippets, site names, and page age. Supports site filters, \
+ time ranges, country filters, and language filters.",
+ inputs: vec![
+ FieldSchema {
+ name: "query",
+ ty: TypeSchema::String,
+ comment: "Search query string.",
+ required: true,
+ },
+ FieldSchema {
+ name: "max_results",
+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ comment: "Max results (1-20, default 10).",
+ required: false,
+ },
+ FieldSchema {
+ name: "count",
+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ comment: "Querit-native alias for max_results.",
+ required: false,
+ },
+ FieldSchema {
+ name: "filters",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Json)),
+ comment:
+ "Querit-native filters object with sites, timeRange, geo, and languages.",
+ required: false,
+ },
+ FieldSchema {
+ name: "include_domains",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::String,
+ )))),
+ comment: "Only fetch results from these domains.",
+ required: false,
+ },
+ FieldSchema {
+ name: "exclude_domains",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::String,
+ )))),
+ comment: "Exclude results from these domains.",
+ required: false,
+ },
+ FieldSchema {
+ name: "time_range",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Querit date filter: d7, w2, m6, y1, or YYYY-MM-DDtoYYYY-MM-DD.",
+ required: false,
+ },
+ FieldSchema {
+ name: "from_date",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Start date for a Querit date-range filter (YYYY-MM-DD).",
+ required: false,
+ },
+ FieldSchema {
+ name: "to_date",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "End date for a Querit date-range filter (YYYY-MM-DD).",
+ required: false,
+ },
+ FieldSchema {
+ name: "countries",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::String,
+ )))),
+ comment: "Country filters, e.g. united states, japan, germany.",
+ required: false,
+ },
+ FieldSchema {
+ name: "languages",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::String,
+ )))),
+ comment: "Language filters, e.g. english, japanese, german.",
+ required: false,
+ },
+ ],
+ outputs: vec![FieldSchema {
+ name: "results",
+ ty: TypeSchema::String,
+ comment: "Formatted Querit search results.",
+ required: true,
+ }],
+ },
+ "tools_searxng_search" => ControllerSchema {
+ namespace: "tools",
+ function: "searxng_search",
+ description:
+ "Web search via a user-configured SearXNG instance. Returns normalized \
+ results with title, URL, snippet, and source. Intended for private, \
+ self-hosted search without routing queries through the OpenHuman backend.",
+ inputs: vec![
+ FieldSchema {
+ name: "query",
+ ty: TypeSchema::String,
+ comment: "Search query string.",
+ required: true,
+ },
+ FieldSchema {
+ name: "categories",
+ ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
+ TypeSchema::Enum {
+ variants: vec!["web", "general", "news", "images"],
+ },
+ )))),
+ comment: "Optional SearXNG categories. `web` maps to SearXNG `general`.",
+ required: false,
+ },
+ FieldSchema {
+ name: "language",
+ ty: TypeSchema::Option(Box::new(TypeSchema::String)),
+ comment: "Optional language code, e.g. `en`, `zh-CN`, or `fr`.",
+ required: false,
+ },
+ FieldSchema {
+ name: "max_results",
+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
+ comment: "Max results (1-50, default from searxng.max_results).",
+ required: false,
+ },
+ ],
+ outputs: vec![FieldSchema {
+ name: "results",
+ ty: TypeSchema::Array(Box::new(TypeSchema::Json)),
+ comment: "Each item: {title, url, snippet, source}.",
+ required: true,
+ }],
+ },
+ "tools_apify_linkedin_scrape" => ControllerSchema {
+ namespace: "tools",
+ function: "apify_linkedin_scrape",
+ description: "Run the Apify LinkedIn profile scraper actor on a single profile \
+ URL and return both the raw scraped item and a pre-rendered \
+ markdown view of it (same layout as the legacy enrichment pipeline).",
+ inputs: vec![FieldSchema {
+ name: "profile_url",
+ ty: TypeSchema::String,
+ comment: "Canonical LinkedIn profile URL (`https://www.linkedin.com/in/<slug>`).",
+ required: true,
+ }],
+ outputs: vec![
+ FieldSchema {
+ name: "data",
+ ty: TypeSchema::Json,
+ comment: "Raw scraped profile JSON from Apify.",
+ required: true,
+ },
+ FieldSchema {
+ name: "markdown",
+ ty: TypeSchema::String,
+ comment: "Markdown rendering of the scraped profile (full, pre-summary).",
+ required: true,
+ },
+ ],
+ },
+ _ => ControllerSchema {
+ namespace: "tools",
+ function: "unknown",
+ description: "Unknown tools controller.",
+ inputs: vec![],
+ outputs: vec![FieldSchema {
+ name: "error",
+ ty: TypeSchema::String,
+ comment: "Lookup error details.",
+ required: true,
+ }],
+ },
+ }
+}