openclaw - 💡(How to fix) Fix Expose active model/provider metadata or support model-scoped native plugin tools [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77857Fetched 2026-05-06 06:20:16
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
2
Timeline (top)
commented ×2mentioned ×1subscribed ×1

Native plugin tools need a trustworthy way to know which model/provider session invoked a tool call, or a way to register tools only for specific model/provider scopes.

This is needed for privacy-sensitive local tools where access is appropriate for approved local/private models but should remain unavailable to cloud-led or unknown-trust sessions.

Root Cause

This enables OpenClaw to support local-first/private-data workflows without forcing plugins to either expose private source tools too broadly or disable useful local-only capabilities entirely.

A downstream plugin can implement the local-only retrieval path, but must keep it fail-closed until native tools can prove the active model/provider or OpenClaw can scope tool registration by model/provider.

Code Example

if (context.modelProvider !== "local-provider") deny();
if (!approvedModels.has(context.model)) deny();

---

interface OpenClawPluginToolContext {
  sessionId: string;
  sessionKey?: string;
  modelProvider?: string;
  model?: string;
  modelRef?: string;
}

---

api.registerTool(tool, {
  availability: {
    providers: ["local-provider"],
    models: ["local-model-a", "local-model-b"]
  }
});
RAW_BUFFERClick to expand / collapse

Summary

Native plugin tools need a trustworthy way to know which model/provider session invoked a tool call, or a way to register tools only for specific model/provider scopes.

This is needed for privacy-sensitive local tools where access is appropriate for approved local/private models but should remain unavailable to cloud-led or unknown-trust sessions.

Use case

A plugin may need two separate tool paths for the same private data source:

  • A safe bridge tool for cloud-led or unknown sessions. It returns only a bounded answer plus policy-filtered evidence/audit.
  • A local/private source-packet tool. It returns sanitized private source material to the active local model so the selected local session can reason over it directly.

The second tool should be available only when the active session is using an approved local provider/model. It should not be callable from cloud or unknown-trust sessions.

Current blocker

The current native plugin tool execution context exposes session/workspace/sender/runtime metadata, but not trustworthy active model/provider metadata.

That means a plugin cannot safely enforce logic like:

if (context.modelProvider !== "local-provider") deny();
if (!approvedModels.has(context.model)) deny();

Without runtime-owned model identity, privacy-sensitive source tools must either stay disabled by default or rely on unsafe development-only gates.

Requested capability

Please add one or both of the following.

Option A: Active model/provider metadata in tool execution context

Expose trusted active session model metadata to native plugin tools, for example:

interface OpenClawPluginToolContext {
  sessionId: string;
  sessionKey?: string;
  modelProvider?: string;
  model?: string;
  modelRef?: string;
}

The important requirement is that this metadata is supplied by the OpenClaw runtime, not by user/tool params.

Option B: Model-scoped tool registration

Allow plugins to register tools with provider/model availability constraints, for example:

api.registerTool(tool, {
  availability: {
    providers: ["local-provider"],
    models: ["local-model-a", "local-model-b"]
  }
});

OpenClaw would then only expose/call that tool in matching sessions.

Security / privacy motivation

Some tools are safe for all models because they return bounded, public, or policy-filtered data.

Other tools are safe only for local/private models because they return sanitized but still private source material. Sanitized text from a private source is still private content. It may be appropriate for a local model running in a local/private session, but not for a cloud model.

This distinction cannot be enforced reliably inside a plugin without runtime-owned model/provider identity.

Desired behavior

For an approved local model session:

  • The local source-packet tool is available.
  • Tool call context confirms the approved local model/provider, or OpenClaw has already scoped registration to that model/provider.
  • The plugin can return sanitized source packets to the same local session.

For a cloud or unknown-trust model session:

  • The local source-packet tool is unavailable, or the plugin can fail closed based on trusted context.
  • The safer bounded-answer bridge remains available.

Compatibility

This should not break existing plugins. Missing model/provider metadata can remain optional at first, but privacy-sensitive plugins need a documented stable field or scoped-registration API before enabling local-only source tools by default.

Why this matters

This enables OpenClaw to support local-first/private-data workflows without forcing plugins to either expose private source tools too broadly or disable useful local-only capabilities entirely.

A downstream plugin can implement the local-only retrieval path, but must keep it fail-closed until native tools can prove the active model/provider or OpenClaw can scope tool registration by model/provider.

extent analysis

TL;DR

To address the privacy concerns, OpenClaw should provide a way for native plugins to determine the active model/provider session or allow tool registration with model/provider constraints.

Guidance

  • Introduce a new field in the OpenClawPluginToolContext interface to include trusted active session model metadata, such as modelProvider and model.
  • Implement model-scoped tool registration using an availability object with providers and models properties.
  • Update the plugin registration API to accept the new availability constraints.
  • Ensure that the new metadata and registration mechanism do not break existing plugins by making the new fields optional.

Example

interface OpenClawPluginToolContext {
  // ...
  modelProvider?: string;
  model?: string;
}

api.registerTool(tool, {
  availability: {
    providers: ["local-provider"],
    models: ["local-model-a", "local-model-b"]
  }
});

Notes

The implementation should prioritize security and privacy, ensuring that sensitive data is only accessible to approved local models and providers. The new features should be documented and backward compatible to avoid breaking existing plugins.

Recommendation

Apply the workaround by introducing the new modelProvider and model fields in the OpenClawPluginToolContext and implementing model-scoped tool registration. This will enable plugins to enforce privacy-sensitive logic and ensure that local-only source tools are only available to approved local models.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Expose active model/provider metadata or support model-scoped native plugin tools [2 comments, 2 participants]