Expand description
The bazaar extension for resource discovery and cataloging.
The bazaar extension for resource discovery and cataloging.
The bazaar extension enables resource servers to declare their endpoint
specifications (HTTP method or MCP tool name, input parameters, and output format)
so that facilitators can catalog and index them in a discovery service.
§Example: GET Endpoint
use x402_extensions::bazaar::*;
use x402_core::types::Extension;
use serde_json::json;
let info = BazaarInfo::builder()
.input(BazaarInput::Http(BazaarHttpInput::builder()
.method(HttpMethod::GET)
.query_params(json!({"city": "San Francisco"}))
.build()))
.output(BazaarOutput::builder()
.output_type("json")
.example(json!({"city": "San Francisco", "weather": "foggy"}))
.build())
.build();
let ext = Extension::typed(info);
let (key, transport) = ext.into_pair();
assert_eq!(key, "bazaar");§Example: POST Endpoint
use x402_extensions::bazaar::*;
use x402_core::types::Extension;
use serde_json::json;
let info = BazaarInfo::builder()
.input(BazaarInput::Http(BazaarHttpInput::builder()
.method(HttpMethod::POST)
.body_type("json")
.body(json!({"query": "example"}))
.build()))
.build();
let ext = Extension::typed(info);
let (key, _) = ext.into_pair();
assert_eq!(key, "bazaar");§Example: MCP Tool
use x402_extensions::bazaar::*;
use x402_core::types::Extension;
use serde_json::json;
let info = BazaarInfo::builder()
.input(BazaarInput::Mcp(BazaarMcpInput::builder()
.tool("financial_analysis")
.input_schema(json!({
"type": "object",
"properties": {
"ticker": { "type": "string" }
},
"required": ["ticker"]
}))
.description("AI-powered financial analysis")
.build()))
.output(BazaarOutput::builder()
.output_type("json")
.example(json!({"summary": "Strong fundamentals", "score": 8.5}))
.build())
.build();
let ext = Extension::typed(info);
let (key, _) = ext.into_pair();
assert_eq!(key, "bazaar");Structs§
- Bazaar
Http Input - HTTP endpoint input specification.
- Bazaar
Http Input Builder - Use builder syntax to set the inputs and finish with
build(). - Bazaar
Info - Discovery info for the
bazaarextension. - Bazaar
Info Builder - Use builder syntax to set the inputs and finish with
build(). - Bazaar
McpInput - MCP tool input specification.
- Bazaar
McpInput Builder - Use builder syntax to set the inputs and finish with
build(). - Bazaar
Output - Output specification for a bazaar discovery entry.
- Bazaar
Output Builder - Use builder syntax to set the inputs and finish with
build().
Enums§
- Bazaar
Input - Discriminated union for input types.
- Http
Method - HTTP methods supported by the bazaar extension.
- McpTransport
- MCP transport protocol options.