Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling Provider-aware JSON Schema normalization for tool declarations. Schema normalization adapter for LLM provider function-calling APIs.
Each LLM provider has different JSON Schema requirements for tool parameters.
The SchemaAdapter trait provides a consistent interface for transforming
raw MCP tool schemas into the provider’s accepted format at request time.
§Architecture
McpToolset returns raw schemas verbatim. Each model adapter implements
SchemaAdapter to normalize schemas according to its backend’s limitations.
This separation keeps MCP tool discovery independent of LLM-specific concerns.
§Example
use adk_core::SchemaAdapter;
use serde_json::{json, Value};
use std::borrow::Cow;
#[derive(Debug)]
struct MyAdapter;
impl SchemaAdapter for MyAdapter {
fn normalize_schema(&self, schema: Value) -> Value {
// Apply provider-specific transforms
schema
}
}
let adapter = MyAdapter;
let raw = json!({"type": "object", "properties": {"name": {"type": "string"}}});
let normalized = adapter.normalize_schema(raw);Structs§
- Generic
Schema Adapter - Default schema adapter for providers with no specific requirements (Ollama, etc.).
Traits§
- Schema
Adapter - Normalizes JSON Schema for a specific LLM provider’s function-calling API.