Use the shared Rust library when embedding Kinic Wiki VFS tool calling into an OpenAI-compatible client.
This is not shelling out to kinic-vfs-cli; it uses the same canister-backed VFS through the shared client and tool dispatcher.
For direct read-only canister queries without tool schemas, use the Store API described in STORE_API.md.
use anyhow::Result;
use vfs_cli::agent_tools::{create_openai_tools, handle_openai_tool_call};
use vfs_client::CanisterVfsClient;
async fn run() -> Result<()> {
let client = CanisterVfsClient::new(
"http://127.0.0.1:8000",
"aaaaa-aa",
)
.await?;
let tools = create_openai_tools();
// Pass `tools` into your OpenAI-compatible SDK request.
// When the model returns a tool call:
let result = handle_openai_tool_call(
&client,
"read",
r#"{"database_id":"<database-id>","path":"/Knowledge/index.md"}"#,
)
.await?;
println!("{}", result.text);
Ok(())
}The dispatcher also exposes Anthropic-format schemas through create_anthropic_tools and handle_anthropic_tool_call.
Use create_openai_read_only_tools and handle_openai_read_only_tool_call when an agent should only inspect wiki and skill content.
Write tools such as write, append, edit, multi_edit, rm, and skill_record_run require a client identity with writer access to the selected database.
The read-only dispatcher rejects any tool name outside the read-only set even if a caller forwards an unexpected write tool call.
Current tool names:
readread_contextwriteappendeditlsmkdirmvglobgraph_neighborhoodgraph_linksincoming_linksoutgoing_linksmulti_editrmsearchsearch_pathsskill_findskill_inspectskill_readskill_record_run
Read-only tools are:
readread_contextlssearchsearch_pathsskill_findskill_inspectskill_readgraph_neighborhoodgraph_linksincoming_linksoutgoing_links
Skill discovery and read tools are read-only runtime helpers.
Agents should call skill_find at task start, inspect promising candidates, read SKILL.md and package-local helper files with skill_read, then apply those instructions to the current task.
skill_record_run is a write tool for agent-side evidence capture and is excluded from read-only tool sets.
Use the CLI for operational writes such as skill upsert, skill rollback, database link, and imports.