Skip to main content

Module openapi

Module openapi 

Source
Expand description

OpenAPI → Agent Tool: convert any API spec into a searchable, callable tool.

Instead of 845 individual MCP tools for GitHub API, one api tool:

  • api search "create issue" → fuzzy-find endpoints
  • api call repos_owner_repo_issues_post --owner=foo --repo=bar --title="bug" → execute

§Usage

use sgr_agent::openapi::{ApiRegistry, ApiAuth};

let mut registry = ApiRegistry::new();
registry.add_api("github", "https://api.github.com", &spec_json, ApiAuth::Bearer("ghp_xxx".into())).unwrap();
let results = registry.search("github", "create issue", 5);

Re-exports§

pub use caller::ApiAuth;
pub use registry::ApiSpec;
pub use registry::default_cache_dir;
pub use registry::download_spec;
pub use registry::load_api_registry;
pub use registry::load_or_download;
pub use registry::popular_apis;
pub use registry::search_apis_guru;
pub use search::SearchResult;
pub use search::format_results;
pub use search::search_endpoints;
pub use spec::Endpoint;
pub use spec::Param;
pub use spec::ParamLocation;
pub use spec::filter_endpoints;
pub use spec::parse_spec;

Modules§

caller
HTTP caller — execute API requests from endpoint definitions.
registry
Auto-discovery and caching of OpenAPI specs.
search
Fuzzy search over API endpoints using nucleo.
spec
OpenAPI spec parser — extract endpoints from JSON/YAML specs.

Structs§

ApiRegistry
Registry of loaded API specs. Each API has a name, base URL, and parsed endpoints.