Documentation
¶
Overview ¶
Package providertools resolves provider-managed capabilities from exact, auditable profiles. It deliberately does not infer private APIs from brand or model-name substrings.
Index ¶
- Constants
- func BigModelSearchMCPServerName() string
- func EffectiveMCPServers(cfg *config.Config) map[string]*config.MCPServer
- func ImageEndpointProfile(runtime ImageRuntime) string
- func IsProviderSearchMCPServer(name string) bool
- type ImageModel
- type ImageRuntime
- type ProviderCapability
- type WebSearchRuntime
Constants ¶
const ( ToolImageGeneration = "image_generation" ToolWebSearch = "web_search" BigModelCodingProvider = "zhipuai-coding-plan" AlibabaTokenPlanCNProvider = "alibaba-token-plan-cn" )
const BigModelSearchMCPToolName = "web_search_prime"
BigModelSearchMCPToolName is the only upstream tool allowed through the provider-managed BigModel search preset. Reserved-server ownership alone is insufficient because a vendor could add a side-effecting tool to the same endpoint in the future.
Variables ¶
This section is empty.
Functions ¶
func BigModelSearchMCPServerName ¶
func BigModelSearchMCPServerName() string
BigModelSearchMCPServerName returns the reserved local owner name used for the provider-managed preset. It contains no endpoint or credential data.
func EffectiveMCPServers ¶
EffectiveMCPServers adds provider-managed MCP presets to a detached runtime map. The detached Authorization header is never assigned to Config.MCPServers and therefore cannot be returned by generic MCP CRUD endpoints.
func ImageEndpointProfile ¶
func ImageEndpointProfile(runtime ImageRuntime) string
ImageEndpointProfile is an opaque, Settings-safe identifier for the final resolved endpoint. The endpoint URL itself is never returned by capability metadata or written to session records.
Types ¶
type ImageModel ¶
type ImageModel struct {
Provider string `json:"provider"`
ID string `json:"id"`
Name string `json:"name"`
Protocol string `json:"protocol"`
Sizes []string `json:"sizes,omitempty"`
AspectRatios []string `json:"aspect_ratios,omitempty"`
Resolutions []string `json:"resolutions,omitempty"`
Builtin bool `json:"builtin"`
Supported bool `json:"supported"`
}
func ImageModels ¶
func ImageModels(cfg *config.Config) []ImageModel
ImageModels returns only models backed by an exact built-in profile or an explicit custom ImageEndpoint. Merely having an OpenAI-compatible chat base URL never creates an image capability.
type ImageRuntime ¶
type ImageRuntime struct {
Provider string
Model string
Protocol imagegen.Protocol
BaseURL string
APIKey string
AuthMethod string
AccountID string
Headers map[string]string
AssetHosts []string
CredentialFingerprint string
ConfigEpoch string
MaxCallsPerTurn int
MaxCallsPerSession int
}
func ResolveImageRuntime ¶
func ResolveImageRuntime(cfg *config.Config) (ImageRuntime, error)
ResolveImageRuntime is the execution gate for generate_image. Image generation is an independent configured model role, so provider tool policy does not enable or disable it. An empty image_model, missing credential, unknown model, or unknown protocol fails closed and keeps the tool out.
type ProviderCapability ¶
type ProviderCapability struct {
ID string `json:"id"`
Availability string `json:"availability"`
Mechanism string `json:"mechanism,omitempty"`
ModelLabel string `json:"model_label,omitempty"`
Enabled bool `json:"enabled"`
MaxCallsPerTurn int `json:"max_calls_per_turn"`
MaxCallsPerSession int `json:"max_calls_per_session"`
}
ProviderCapability is a Settings-safe capability snapshot. It contains only user-facing mechanism and policy metadata; credentials, endpoint URLs, and credential fingerprints are intentionally excluded.
func ProviderCapabilities ¶
func ProviderCapabilities(cfg *config.Config, providerID string) []ProviderCapability
ProviderCapabilities returns the manifest-derived Settings view for one configured provider. Independent model roles such as image generation are intentionally represented by ImageModels instead of this policy surface.
type WebSearchRuntime ¶
type WebSearchRuntime struct {
ProviderProfileID string
CredentialFingerprint string
ConfigEpoch string
ModelLabel string
MaxCallsPerTurn int
MaxCallsPerSession int
}
WebSearchRuntime is deliberately metadata-only. Provider credentials and transport details are attached only to the detached MCP runtime returned by EffectiveMCPServers; approval and quota code can use this value without gaining access to an API key, Authorization header, or endpoint URL.
func ResolveWebSearchRuntime ¶
func ResolveWebSearchRuntime(cfg *config.Config) (WebSearchRuntime, error)
ResolveWebSearchRuntime resolves the single supported provider-managed web search profile. It fails closed for custom/proxy endpoints, disabled policy, or missing credentials and never returns the credential or MCP URL.
func ResolveWebSearchTransportRuntime ¶
func ResolveWebSearchTransportRuntime(cfg *config.Config) (WebSearchRuntime, error)
ResolveWebSearchTransportRuntime resolves the detached trusted MCP transport independently of the current chat model. A process can host tasks using different chat providers, so the transport must remain connected while any exact enabled provider profile exists. ResolveWebSearchRuntime remains the per-agent injection gate and prevents this endpoint from crossing the active chat-provider boundary.