runtimeInjectsToolDeclarations property

bool runtimeInjectsToolDeclarations
latefinal

Whether the runtime/SDK injects the tool declarations itself, so this chat must NOT weave its own JSON tools prompt (that would double-wrap them). The engine's explicit override wins; absent one it derives from the model's FunctionCallFormat (true for SDK-passthrough models: Gemma 4, and FunctionGemma on .litertlm). This replaces the former hardcoded modelType == ModelType.gemma4 check, so an engine that injects tools natively could opt in for any model type. No shipping engine sets the override yet (both models get true via their format).

NOTE: this governs the INPUT side only (skipping declaration injection). Reading tool calls BACK is still keyed off FunctionCallParser.usesSdkPassthrough (see generateChatResponse / generateChatResponseAsync), which is model-format-derived and not per-chat overridable — so an engine that sets this true on a non-passthrough model gets calls parsed from the text stream, not from a structured SDK response.

Implementation

late final bool runtimeInjectsToolDeclarations =
    _runtimeInjectsToolDeclarationsOverride ??
    FunctionCallParser.runtimeInjectsToolDeclarations(
      modelType,
      fileType: fileType,
    );