platformtools

package
v0.0.0-...-1a68bba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceLogs                     = "logs"
	SourceMemory                   = "memory"
	SourcePlatform                 = "platform"
	SourceSlack                    = "slack"
	SourceTriggers                 = "triggers"
	ToolNameSearchLogs             = "platform_search_logs"
	ToolNameListTriggers           = "platform_list_triggers"
	ToolNameConfigureTrigger       = "platform_configure_trigger"
	ToolNameMemoryForget           = "platform_memory_forget"
	ToolNameMemoryRecall           = "platform_memory_recall"
	ToolNameMemoryRemember         = "platform_memory_remember"
	ToolNameReadChannelMessages    = "platform_slack_read_channel_messages"
	ToolNameReadThreadMessages     = "platform_slack_read_thread_messages"
	ToolNameReadUserProfile        = "platform_slack_read_user_profile"
	ToolNameSearchChannels         = "platform_slack_search_channels"
	ToolNameSearchMessagesAndFiles = "platform_slack_search_messages_and_files"
	ToolNameSearchUsers            = "platform_slack_search_users"
	ToolNameScheduleMessage        = "platform_slack_schedule_message"
	ToolNameSendMessage            = "platform_slack_send_message"
	ToolNameAddReaction            = "platform_slack_add_reaction"
	ToolNameRemoveReaction         = "platform_slack_remove_reaction"
	ToolNameGetReactions           = "platform_slack_get_reactions"
	ToolNameListReactions          = "platform_slack_list_reactions"
	ToolNameListEmoji              = "platform_slack_list_emoji"
	ToolNameListUserSessions       = "platform_list_user_sessions"
	ToolNameGetUserSession         = "platform_get_user_session"
	ToolNameGetPlatformContext     = "platform_get_platform_context"
	ToolNameListProjects           = "platform_list_projects"
	ToolNameFindMCP                = "platform_find_mcp"
	ToolNameGetMCP                 = "platform_get_mcp"
)
View Source
const AssistantsPlatformToolsetSlug = "assistants"

AssistantsPlatformToolsetSlug is the reserved slug for the platform toolset granted to every assistant runtime.

View Source
const ManagedAssistantPlatformToolsetSlug = "managed-assistant"

ManagedAssistantPlatformToolsetSlug is the reserved slug for the platform toolset granted only to a project's managed assistant (the one powering the dashboard sidebar). It carries tools that must not be reachable by any other assistant.

View Source
const PlatformMCPReadToolsetSlug = "platform"

PlatformMCPReadToolsetSlug is the reserved slug for the platform toolset re-serving the Platform MCP read tools to a project's managed assistant. Granted only when the assistant-platform-mcp rollout flag is on for the organization.

View Source
const ResearchToolsetSlug = "research"

ResearchToolsetSlug is the reserved slug for the MCP research agent's web tools (search and page fetch). No assistant is granted it by default; the research-agent runner attaches it explicitly, and its tools are gated on the mcp_approval feature.

View Source
const (
	ToolNameSkillsLoad = "skills_load"
)

Skill tool names are externally specified by the skills RFC.

Variables

This section is empty.

Functions

func BuildExecutors

func BuildExecutors(deps Dependencies, extras ...ExternalTool) (map[string]PlatformToolExecutor, map[string]string)

BuildExecutors materializes executors for built-in plus caller-supplied platform tools. The second return value maps URN to the required feature gate; absent entries are ungated.

func BuildToolsets

func BuildToolsets(deps ToolsetDependencies) map[string]Toolset

BuildToolsets materializes every registered platform toolset against the supplied dependencies and returns them indexed by slug. Panics on misconfiguration (empty slug or duplicate slug) so registry mistakes surface at startup instead of as runtime 404s.

func FindToolEntries

func FindToolEntries(toolURNs []string, extras ...ExternalTool) []*types.ToolEntry

func FindTypedTools

func FindTypedTools(projectID uuid.UUID, toolURNs []string, extras ...ExternalTool) []*types.Tool

func ListTypedTools

func ListTypedTools(
	ctx context.Context,
	organizationID string,
	projectID uuid.UUID,
	urnPrefix string,
	checker FeatureChecker,
	extras ...ExternalTool,
) []*types.Tool

ListTypedTools enumerates platform tools available to organizationID, excluding any whose required feature flag is disabled. A nil checker grants access to every gated tool.

func PlatformToolsetURL

func PlatformToolsetURL(base *url.URL, slug string) string

PlatformToolsetURL builds the URL where a runtime reaches the named platform toolset. Keep the path segments in lockstep with the chi route registered by the mcp package.

Types

type Dependencies

type Dependencies struct {
	Logger           *slog.Logger
	DB               *pgxpool.Pool
	TelemetryService TelemetryService
	TriggerApp       *bgtriggers.App
	SlackHTTPClient  *guardian.HTTPClient
	Audit            *audit.Logger

	// Encryption seals the payload behind minted asset download URLs.
	Encryption *encryption.Client

	// ServerURL is the public base URL minted download URLs point at.
	ServerURL *url.URL
}

type ExternalTool

type ExternalTool struct {
	Executor        PlatformToolExecutor
	RequiredFeature string // empty string = always available
}

type FeatureChecker

type FeatureChecker func(ctx context.Context, organizationID string, feature string) bool

FeatureChecker reports whether a product feature is enabled for an organization. Features are referenced by string name to avoid a productfeatures import cycle through openrouter -> productfeatures -> auth -> mv -> platformtools.

type PlatformToolExecutor

type PlatformToolExecutor = core.PlatformToolExecutor

type TelemetryService

type TelemetryService = logs.TelemetryService

type ToolDescriptor

type ToolDescriptor = core.ToolDescriptor

func FindToolDescriptor

func FindToolDescriptor(toolURN urn.Tool, extras ...ExternalTool) (ToolDescriptor, bool)

func ListPlatformTools

func ListPlatformTools(extras ...ExternalTool) []ToolDescriptor

ListPlatformTools returns descriptors without applying feature gates; callers that need per-org gating should use ListTypedTools instead.

type Toolset

type Toolset struct {
	Slug  string
	Tools []ExternalTool
}

Toolset is a virtual collection of platform tools exposed at runtime via a dedicated MCP endpoint. Platform toolsets are not persisted; the slug is hardcoded per consumer and wired in code at process startup.

func NewAssistantsToolset

func NewAssistantsToolset(tools ...ExternalTool) Toolset

NewAssistantsToolset returns the assistants platform toolset bound to the supplied tools. Exposed for tests and direct callers; production wiring goes through BuildToolsets.

func NewManagedAssistantToolset

func NewManagedAssistantToolset(tools ...ExternalTool) Toolset

NewManagedAssistantToolset returns the platform toolset granted only to a project's managed assistant. Exposed for tests and direct callers; production wiring goes through BuildToolsets.

func NewPlatformMCPReadToolset

func NewPlatformMCPReadToolset(tools ...ExternalTool) Toolset

NewPlatformMCPReadToolset returns the platform toolset re-serving the Platform MCP read tools to a project's managed assistant. Exposed for tests and direct callers; production wiring goes through BuildToolsets.

type ToolsetDependencies

type ToolsetDependencies struct {
	AssistantMemoryTools          []ExternalTool
	AssistantSkillTools           []ExternalTool
	AssistantTriggerTools         []ExternalTool
	ManagedAssistantInsightsTools []ExternalTool
	PlatformMCPReadTools          []ExternalTool
}

ToolsetDependencies bundles the inputs required to materialize the static platform toolset registry. Add a field here when a new toolset needs an external service or pre-built tool slice.

Directories

Path Synopsis
Package changelog exposes the public Speakeasy platform changelog as a read-only platform tool for the project's managed assistant.
Package changelog exposes the public Speakeasy platform changelog as a read-only platform tool for the project's managed assistant.
Package docs exposes the public Speakeasy AI control plane documentation (speakeasy.com/docs/ai-control-plane) as read-only platform tools for the project's managed assistant.
Package docs exposes the public Speakeasy AI control plane documentation (speakeasy.com/docs/ai-control-plane) as read-only platform tools for the project's managed assistant.
Package memory implements the gram://memory/* platform tools that wrap the MemoryService for use by assistant agents at runtime.
Package memory implements the gram://memory/* platform tools that wrap the MemoryService for use by assistant agents at runtime.
Package platform re-serves the Platform MCP read tools (server/internal/platformmcp) as platform tools on the assistant runtime channel.
Package platform re-serves the Platform MCP read tools (server/internal/platformmcp) as platform tools on the assistant runtime channel.
Package research provides the MCP research agent's web tools: search and page fetch.
Package research provides the MCP research agent's web tools: search and page fetch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL