Provider Transcript Grammar (src/provider_transcript.rs)

ironclaw · crates/contracts/ironclaw_common/src/provider_transcript.rs · rust · Apache-2.0
ai, voice, dev-tools, lang:rust

A shared utility for formatting and parsing tool-result artifacts in AI transcripts. Use this to ensure compatibility when providers require text-based representations of tool interactions.

// Source: https://github.com/nearai/ironclaw | License: Apache-2.0 | Copyright 2026 NEAR AI
// Provided via justclaw.it.com; keep this notice with the code.
//! Shared grammar for provider transcript artifacts.
//!
//! Some providers cannot preserve native tool-result roles and need a textual
//! compatibility representation. Keep that representation centralized so
//! producers, response cleanup, and final-reply admission cannot drift.

pub const LEGACY_TOOL_EVENT_PREFIX: &str = "Previous tool event: ";
pub const LEGACY_TOOL_EVENT_SUFFIX: &str = " was invoked.";
pub const LEGACY_TOOL_RESULT_PREFIX: &str = "Previous tool result from ";
pub const TOOL_RESULT_OBSERVATION_PREFIX: &str = "Tool result from ";

pub fn format_tool_result_observation(tool_name: &str, result: &str) -> String {
   

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key