Documentation
¶
Overview ¶
Package webtools is the single home for the builtin web-tool backends (DeepSeek, Serper, Jina): backend selection, readiness, tool schemas and text rendering. It is the web-tool analog of internal/vision/visionproxy — a self-contained package with one entry point (Call), consumed by the stdio MCP server (internal/mcp/builtin_server) and the MCP runtime. It imports only internal/client, internal/typ and its own backend subpackages, never internal/mcp, so every layer can depend on it without a cycle.
Index ¶
- Constants
- func BackendName(env map[string]string, tool string) (string, error)
- func Call(ctx context.Context, env map[string]string, tool string, args map[string]any) (string, error)
- func EnvFromOS() map[string]string
- func IsTool(name string) bool
- func Ready(env map[string]string, tool string) bool
- type Backend
- type ToolDefinition
Constants ¶
const ( ToolWebSearch = constant.WebSearchToolName ToolWebFetch = constant.WebFetchToolName )
Tool names (canonical, defined in internal/constant). internal/mcp/tools re-exports the same values.
const ( BackendDeepSeek = "deepseek" BackendSerper = "serper" BackendJina = "jina" )
Backend names.
Variables ¶
This section is empty.
Functions ¶
func BackendName ¶
BackendName resolves which backend serves tool under env, without building it. This is the one selection rule shared by discovery, readiness and execution: unset (or obsolete "auto") and an explicit DeepSeek both select DeepSeek for both tools; the legacy explicit Serper/Jina choices are honored. A missing DeepSeek token is deliberately NOT an error here — the tool stays selectable and the call fails with an actionable "enter a token" error on use (see .design/arch/web-server-tools-arch.md); gating it would drop the tool from injection instead.
func Call ¶
func Call(ctx context.Context, env map[string]string, tool string, args map[string]any) (string, error)
Call selects a backend for tool and executes it. It never sends an empty-token request: an unavailable DeepSeek backend returns its actionable error instead.
Types ¶
type Backend ¶
type Backend interface {
Name() string
Search(ctx context.Context, args map[string]any) (string, error)
Fetch(ctx context.Context, args map[string]any) (string, error)
}
Backend is one web-tool provider. Serper serves only Search and Jina only Fetch; their unused method returns an error (selection never routes to them for the other tool).
type ToolDefinition ¶
ToolDefinition is a backend-neutral tool schema. internal/mcp builds MCP tools from it; discovery only needs name/description/schema.
func Definitions ¶
func Definitions() []ToolDefinition
Definitions returns the static web-tool schemas. Being static lets disabled Server Tools stay discoverable without a process or credentials.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package deepseek implements DeepSeek's read-only web APIs.
|
Package deepseek implements DeepSeek's read-only web APIs. |
|
Package jina implements the Jina Reader web-fetch backend.
|
Package jina implements the Jina Reader web-fetch backend. |
|
Package serper implements the Serper web-search backend.
|
Package serper implements the Serper web-search backend. |