Documentation
¶
Index ¶
- func AllowSet(allowed []string) map[string]bool
- func PageMeta[T any](r *storage.PageResult[T]) map[string]any
- func RegisterAllTools(r *Registry)
- func RegisterCharacterTools(r *Registry)
- func RegisterDeleteTools(r *Registry)
- func RegisterLocationTools(r *Registry)
- func RegisterMemoryTools(r *Registry)
- func RegisterNovelTools(r *Registry)
- func RegisterPreferenceTools(r *Registry)
- func RegisterRWTools(r *Registry)
- func RegisterReaderPerspectiveTools(r *Registry)
- func RegisterSettingTools(r *Registry)
- func RegisterStoryArcTools(r *Registry)
- func RegisterSubagentTools(r *Registry)
- func RegisterTimelineTools(r *Registry)
- func RegisterWebFetchTools(r *Registry)
- func RegisterWebSearchTools(r *Registry)
- func SchemaOf(v any) json.RawMessage
- type CreateArcNodeArgs
- type CreateArcNodeItem
- type CreateArcNodeTool
- func (t *CreateArcNodeTool) Category() ToolCategory
- func (t *CreateArcNodeTool) Description() string
- func (t *CreateArcNodeTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateArcNodeTool) ExposeToLLM() bool
- func (t *CreateArcNodeTool) JSONSchema() json.RawMessage
- func (t *CreateArcNodeTool) Name() string
- func (t *CreateArcNodeTool) NewArgs() any
- type CreateCharacterArgs
- type CreateCharacterItem
- type CreateCharacterTool
- func (t *CreateCharacterTool) Category() ToolCategory
- func (t *CreateCharacterTool) Description() string
- func (t *CreateCharacterTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateCharacterTool) ExposeToLLM() bool
- func (t *CreateCharacterTool) JSONSchema() json.RawMessage
- func (t *CreateCharacterTool) Name() string
- func (t *CreateCharacterTool) NewArgs() any
- type CreateLocationArgs
- type CreateLocationItem
- type CreateLocationRelationArgs
- type CreateLocationRelationItem
- type CreateLocationRelationTool
- func (t *CreateLocationRelationTool) Category() ToolCategory
- func (t *CreateLocationRelationTool) Description() string
- func (t *CreateLocationRelationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateLocationRelationTool) ExposeToLLM() bool
- func (t *CreateLocationRelationTool) JSONSchema() json.RawMessage
- func (t *CreateLocationRelationTool) Name() string
- func (t *CreateLocationRelationTool) NewArgs() any
- type CreateLocationTool
- func (t *CreateLocationTool) Category() ToolCategory
- func (t *CreateLocationTool) Description() string
- func (t *CreateLocationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateLocationTool) ExposeToLLM() bool
- func (t *CreateLocationTool) JSONSchema() json.RawMessage
- func (t *CreateLocationTool) Name() string
- func (t *CreateLocationTool) NewArgs() any
- type CreateReaderPerspectiveEntryArgs
- type CreateReaderPerspectiveEntryItem
- type CreateReaderPerspectiveEntryTool
- func (t *CreateReaderPerspectiveEntryTool) Category() ToolCategory
- func (t *CreateReaderPerspectiveEntryTool) Description() string
- func (t *CreateReaderPerspectiveEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateReaderPerspectiveEntryTool) ExposeToLLM() bool
- func (t *CreateReaderPerspectiveEntryTool) JSONSchema() json.RawMessage
- func (t *CreateReaderPerspectiveEntryTool) Name() string
- func (t *CreateReaderPerspectiveEntryTool) NewArgs() any
- type CreateStoryArcArgs
- type CreateStoryArcItem
- type CreateStoryArcTool
- func (t *CreateStoryArcTool) Category() ToolCategory
- func (t *CreateStoryArcTool) Description() string
- func (t *CreateStoryArcTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateStoryArcTool) ExposeToLLM() bool
- func (t *CreateStoryArcTool) JSONSchema() json.RawMessage
- func (t *CreateStoryArcTool) Name() string
- func (t *CreateStoryArcTool) NewArgs() any
- type CreateTimelineEntryArgs
- type CreateTimelineEntryItem
- type CreateTimelineEntryTool
- func (t *CreateTimelineEntryTool) Category() ToolCategory
- func (t *CreateTimelineEntryTool) Description() string
- func (t *CreateTimelineEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *CreateTimelineEntryTool) ExposeToLLM() bool
- func (t *CreateTimelineEntryTool) JSONSchema() json.RawMessage
- func (t *CreateTimelineEntryTool) Name() string
- func (t *CreateTimelineEntryTool) NewArgs() any
- type DeleteRecordArgs
- type DeleteRecordTool
- func (t *DeleteRecordTool) Category() ToolCategory
- func (t *DeleteRecordTool) Description() string
- func (t *DeleteRecordTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *DeleteRecordTool) ExposeToLLM() bool
- func (t *DeleteRecordTool) JSONSchema() json.RawMessage
- func (t *DeleteRecordTool) Name() string
- func (t *DeleteRecordTool) NewArgs() any
- type DisplayInfo
- type DisplayPhase
- type EditArgs
- type EditTool
- func (t *EditTool) Category() ToolCategory
- func (t *EditTool) Description() string
- func (t *EditTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *EditTool) ExposeToLLM() bool
- func (t *EditTool) JSONSchema() json.RawMessage
- func (t *EditTool) Name() string
- func (t *EditTool) NewArgs() any
- type ErrKind
- type GetChapterListArgs
- type GetChapterListTool
- func (t *GetChapterListTool) Category() ToolCategory
- func (t *GetChapterListTool) Description() string
- func (t *GetChapterListTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetChapterListTool) ExposeToLLM() bool
- func (t *GetChapterListTool) JSONSchema() json.RawMessage
- func (t *GetChapterListTool) Name() string
- func (t *GetChapterListTool) NewArgs() any
- type GetCharacterRelationsArgs
- type GetCharacterRelationsTool
- func (t *GetCharacterRelationsTool) Category() ToolCategory
- func (t *GetCharacterRelationsTool) Description() string
- func (t *GetCharacterRelationsTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetCharacterRelationsTool) ExposeToLLM() bool
- func (t *GetCharacterRelationsTool) JSONSchema() json.RawMessage
- func (t *GetCharacterRelationsTool) Name() string
- func (t *GetCharacterRelationsTool) NewArgs() any
- type GetCharactersArgs
- type GetCharactersTool
- func (t *GetCharactersTool) Category() ToolCategory
- func (t *GetCharactersTool) Description() string
- func (t *GetCharactersTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetCharactersTool) ExposeToLLM() bool
- func (t *GetCharactersTool) JSONSchema() json.RawMessage
- func (t *GetCharactersTool) Name() string
- func (t *GetCharactersTool) NewArgs() any
- type GetLocationsArgs
- type GetLocationsTool
- func (t *GetLocationsTool) Category() ToolCategory
- func (t *GetLocationsTool) Description() string
- func (t *GetLocationsTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetLocationsTool) ExposeToLLM() bool
- func (t *GetLocationsTool) JSONSchema() json.RawMessage
- func (t *GetLocationsTool) Name() string
- func (t *GetLocationsTool) NewArgs() any
- type GetReaderPerspectiveArgs
- type GetReaderPerspectiveTool
- func (t *GetReaderPerspectiveTool) Category() ToolCategory
- func (t *GetReaderPerspectiveTool) Description() string
- func (t *GetReaderPerspectiveTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetReaderPerspectiveTool) ExposeToLLM() bool
- func (t *GetReaderPerspectiveTool) JSONSchema() json.RawMessage
- func (t *GetReaderPerspectiveTool) Name() string
- func (t *GetReaderPerspectiveTool) NewArgs() any
- type GetStoryArcsArgs
- type GetStoryArcsTool
- func (t *GetStoryArcsTool) Category() ToolCategory
- func (t *GetStoryArcsTool) Description() string
- func (t *GetStoryArcsTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetStoryArcsTool) ExposeToLLM() bool
- func (t *GetStoryArcsTool) JSONSchema() json.RawMessage
- func (t *GetStoryArcsTool) Name() string
- func (t *GetStoryArcsTool) NewArgs() any
- type GetTimelineArgs
- type GetTimelineTool
- func (t *GetTimelineTool) Category() ToolCategory
- func (t *GetTimelineTool) Description() string
- func (t *GetTimelineTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *GetTimelineTool) ExposeToLLM() bool
- func (t *GetTimelineTool) JSONSchema() json.RawMessage
- func (t *GetTimelineTool) Name() string
- func (t *GetTimelineTool) NewArgs() any
- type InjectMessage
- type PageArgs
- type ReadArgs
- type ReadTool
- func (t *ReadTool) Category() ToolCategory
- func (t *ReadTool) Description() string
- func (t *ReadTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *ReadTool) ExposeToLLM() bool
- func (t *ReadTool) JSONSchema() json.RawMessage
- func (t *ReadTool) Name() string
- func (t *ReadTool) NewArgs() any
- type Registry
- func (r *Registry) Execute(ctx context.Context, name string, rawArgs json.RawMessage, tc ToolContext, ...) *ToolResult
- func (r *Registry) Get(name string) (Tool, bool)
- func (r *Registry) List() []Tool
- func (r *Registry) ListByCategory() map[string][]ToolInfo
- func (r *Registry) OpenAI(allowed map[string]bool) []map[string]any
- func (r *Registry) Register(t Tool)
- type RunSubAgentFunc
- type RunSubagentArgs
- type RunSubagentTool
- func (t *RunSubagentTool) Category() ToolCategory
- func (t *RunSubagentTool) Description() string
- func (t *RunSubagentTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *RunSubagentTool) ExposeToLLM() bool
- func (t *RunSubagentTool) JSONSchema() json.RawMessage
- func (t *RunSubagentTool) Name() string
- func (t *RunSubagentTool) NewArgs() any
- type SearchStoryMemoryArgs
- type SearchStoryMemoryTool
- func (t *SearchStoryMemoryTool) Category() ToolCategory
- func (t *SearchStoryMemoryTool) Description() string
- func (t *SearchStoryMemoryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *SearchStoryMemoryTool) ExposeToLLM() bool
- func (t *SearchStoryMemoryTool) JSONSchema() json.RawMessage
- func (t *SearchStoryMemoryTool) Name() string
- func (t *SearchStoryMemoryTool) NewArgs() any
- type SubAgentRequest
- type Tool
- type ToolCategory
- type ToolContext
- type ToolInfo
- type ToolResult
- type UpdateArcNodeArgs
- type UpdateArcNodeTool
- func (t *UpdateArcNodeTool) Category() ToolCategory
- func (t *UpdateArcNodeTool) Description() string
- func (t *UpdateArcNodeTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateArcNodeTool) ExposeToLLM() bool
- func (t *UpdateArcNodeTool) JSONSchema() json.RawMessage
- func (t *UpdateArcNodeTool) Name() string
- func (t *UpdateArcNodeTool) NewArgs() any
- type UpdateChapterPlanArgs
- type UpdateChapterPlanTool
- func (t *UpdateChapterPlanTool) Category() ToolCategory
- func (t *UpdateChapterPlanTool) Description() string
- func (t *UpdateChapterPlanTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateChapterPlanTool) ExposeToLLM() bool
- func (t *UpdateChapterPlanTool) JSONSchema() json.RawMessage
- func (t *UpdateChapterPlanTool) Name() string
- func (t *UpdateChapterPlanTool) NewArgs() any
- type UpdateCharacterArgs
- type UpdateCharacterRelationshipArgs
- type UpdateCharacterRelationshipTool
- func (t *UpdateCharacterRelationshipTool) Category() ToolCategory
- func (t *UpdateCharacterRelationshipTool) Description() string
- func (t *UpdateCharacterRelationshipTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateCharacterRelationshipTool) ExposeToLLM() bool
- func (t *UpdateCharacterRelationshipTool) JSONSchema() json.RawMessage
- func (t *UpdateCharacterRelationshipTool) Name() string
- func (t *UpdateCharacterRelationshipTool) NewArgs() any
- type UpdateCharacterTool
- func (t *UpdateCharacterTool) Category() ToolCategory
- func (t *UpdateCharacterTool) Description() string
- func (t *UpdateCharacterTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateCharacterTool) ExposeToLLM() bool
- func (t *UpdateCharacterTool) JSONSchema() json.RawMessage
- func (t *UpdateCharacterTool) Name() string
- func (t *UpdateCharacterTool) NewArgs() any
- type UpdateLocationArgs
- type UpdateLocationRelationArgs
- type UpdateLocationRelationTool
- func (t *UpdateLocationRelationTool) Category() ToolCategory
- func (t *UpdateLocationRelationTool) Description() string
- func (t *UpdateLocationRelationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateLocationRelationTool) ExposeToLLM() bool
- func (t *UpdateLocationRelationTool) JSONSchema() json.RawMessage
- func (t *UpdateLocationRelationTool) Name() string
- func (t *UpdateLocationRelationTool) NewArgs() any
- type UpdateLocationTool
- func (t *UpdateLocationTool) Category() ToolCategory
- func (t *UpdateLocationTool) Description() string
- func (t *UpdateLocationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateLocationTool) ExposeToLLM() bool
- func (t *UpdateLocationTool) JSONSchema() json.RawMessage
- func (t *UpdateLocationTool) Name() string
- func (t *UpdateLocationTool) NewArgs() any
- type UpdateReaderPerspectiveEntryArgs
- type UpdateReaderPerspectiveEntryTool
- func (t *UpdateReaderPerspectiveEntryTool) Category() ToolCategory
- func (t *UpdateReaderPerspectiveEntryTool) Description() string
- func (t *UpdateReaderPerspectiveEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateReaderPerspectiveEntryTool) ExposeToLLM() bool
- func (t *UpdateReaderPerspectiveEntryTool) JSONSchema() json.RawMessage
- func (t *UpdateReaderPerspectiveEntryTool) Name() string
- func (t *UpdateReaderPerspectiveEntryTool) NewArgs() any
- type UpdateStoryArcArgs
- type UpdateStoryArcTool
- func (t *UpdateStoryArcTool) Category() ToolCategory
- func (t *UpdateStoryArcTool) Description() string
- func (t *UpdateStoryArcTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateStoryArcTool) ExposeToLLM() bool
- func (t *UpdateStoryArcTool) JSONSchema() json.RawMessage
- func (t *UpdateStoryArcTool) Name() string
- func (t *UpdateStoryArcTool) NewArgs() any
- type UpdateTimelineEntryArgs
- type UpdateTimelineEntryTool
- func (t *UpdateTimelineEntryTool) Category() ToolCategory
- func (t *UpdateTimelineEntryTool) Description() string
- func (t *UpdateTimelineEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpdateTimelineEntryTool) ExposeToLLM() bool
- func (t *UpdateTimelineEntryTool) JSONSchema() json.RawMessage
- func (t *UpdateTimelineEntryTool) Name() string
- func (t *UpdateTimelineEntryTool) NewArgs() any
- type UpsertPreferenceArgs
- type UpsertPreferenceItem
- type UpsertPreferenceTool
- func (t *UpsertPreferenceTool) Category() ToolCategory
- func (t *UpsertPreferenceTool) Description() string
- func (t *UpsertPreferenceTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpsertPreferenceTool) ExposeToLLM() bool
- func (t *UpsertPreferenceTool) JSONSchema() json.RawMessage
- func (t *UpsertPreferenceTool) Name() string
- func (t *UpsertPreferenceTool) NewArgs() any
- type UpsertSettingArgs
- type UpsertSettingItem
- type UpsertSettingTool
- func (t *UpsertSettingTool) Category() ToolCategory
- func (t *UpsertSettingTool) Description() string
- func (t *UpsertSettingTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *UpsertSettingTool) ExposeToLLM() bool
- func (t *UpsertSettingTool) JSONSchema() json.RawMessage
- func (t *UpsertSettingTool) Name() string
- func (t *UpsertSettingTool) NewArgs() any
- type WebFetchArgs
- type WebFetchTool
- func (t *WebFetchTool) Category() ToolCategory
- func (t *WebFetchTool) Description() string
- func (t *WebFetchTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *WebFetchTool) ExposeToLLM() bool
- func (t *WebFetchTool) JSONSchema() json.RawMessage
- func (t *WebFetchTool) Name() string
- func (t *WebFetchTool) NewArgs() any
- type WebSearchArgs
- type WebSearchTool
- func (t *WebSearchTool) Category() ToolCategory
- func (t *WebSearchTool) Description() string
- func (t *WebSearchTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
- func (t *WebSearchTool) ExposeToLLM() bool
- func (t *WebSearchTool) JSONSchema() json.RawMessage
- func (t *WebSearchTool) Name() string
- func (t *WebSearchTool) NewArgs() any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PageMeta ¶
func PageMeta[T any](r *storage.PageResult[T]) map[string]any
PageMeta 从 PageResult 提取分页元信息,供 ToolResult.Data 使用。
func RegisterAllTools ¶
func RegisterAllTools(r *Registry)
RegisterAllTools 注册全部 MCP 工具到注册表。 新增工具后在此方法中调用对应的 Register 函数。
func RegisterCharacterTools ¶
func RegisterCharacterTools(r *Registry)
RegisterCharacterTools 注册角色管理类工具。
func RegisterLocationTools ¶
func RegisterLocationTools(r *Registry)
RegisterLocationTools 注册地点管理类工具。
func RegisterPreferenceTools ¶
func RegisterPreferenceTools(r *Registry)
RegisterPreferenceTools 注册偏好工具。
func RegisterReaderPerspectiveTools ¶
func RegisterReaderPerspectiveTools(r *Registry)
RegisterReaderPerspectiveTools 注册读者认知类工具。
func RegisterStoryArcTools ¶
func RegisterStoryArcTools(r *Registry)
RegisterStoryArcTools 注册叙事弧线管理类工具。
func RegisterSubagentTools ¶
func RegisterSubagentTools(r *Registry)
RegisterSubagentTools 注册子 Agent 工具。
func RegisterTimelineTools ¶
func RegisterTimelineTools(r *Registry)
RegisterTimelineTools 注册时间线管理类工具。
func RegisterWebFetchTools ¶
func RegisterWebFetchTools(r *Registry)
RegisterWebFetchTools 注册网页抓取工具。
func RegisterWebSearchTools ¶
func RegisterWebSearchTools(r *Registry)
RegisterWebSearchTools 注册网络搜索工具。
func SchemaOf ¶
func SchemaOf(v any) json.RawMessage
SchemaOf 从带 jsonschema tag 的 struct 生成 OpenAI function calling 兼容的 JSON Schema。 内部用 github.com/invopop/jsonschema 生成,取 type/properties/required 并将 $defs 内联到 $ref 位置。
Types ¶
type CreateArcNodeArgs ¶
type CreateArcNodeArgs struct {
ArcNodes []CreateArcNodeItem `` /* 126-byte string literal not displayed */
}
CreateArcNodeArgs 是 create_arc_node 的参数。
type CreateArcNodeItem ¶
type CreateArcNodeItem struct {
StoryArcID int64 `json:"arc_id" jsonschema:"required,description=所属弧线ID" validate:"required,min=1"`
Title string `json:"title" jsonschema:"required,description=节点标题,如'发现仇人身份'" validate:"required"`
Description string `json:"description" jsonschema:"description=节点详情"`
TargetChapter int `` /* 133-byte string literal not displayed */
}
CreateArcNodeItem 是 create_arc_node 的单条参数。
type CreateArcNodeTool ¶
type CreateArcNodeTool struct{}
CreateArcNodeTool 新建弧线节点。
func (*CreateArcNodeTool) Category ¶
func (t *CreateArcNodeTool) Category() ToolCategory
func (*CreateArcNodeTool) Description ¶
func (t *CreateArcNodeTool) Description() string
func (*CreateArcNodeTool) Execute ¶
func (t *CreateArcNodeTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateArcNodeTool) ExposeToLLM ¶
func (t *CreateArcNodeTool) ExposeToLLM() bool
func (*CreateArcNodeTool) JSONSchema ¶
func (t *CreateArcNodeTool) JSONSchema() json.RawMessage
func (*CreateArcNodeTool) Name ¶
func (t *CreateArcNodeTool) Name() string
func (*CreateArcNodeTool) NewArgs ¶
func (t *CreateArcNodeTool) NewArgs() any
type CreateCharacterArgs ¶
type CreateCharacterArgs struct {
Characters []CreateCharacterItem `` /* 127-byte string literal not displayed */
}
CreateCharacterArgs 是 create_character 的参数。
type CreateCharacterItem ¶
type CreateCharacterItem struct {
Name string `json:"name" jsonschema:"required,description=角色名称" validate:"required"`
Description string `json:"description" jsonschema:"description=角色自然语言描述,如外貌、身份、背景故事等"`
Personality string `` /* 158-byte string literal not displayed */
Abilities string `json:"abilities" jsonschema:"description=JSON数组,角色能力/技能列表,如[\"剑术\",\"隐身\"]"`
}
CreateCharacterItem 是 create_character 的单条参数。
type CreateCharacterTool ¶
type CreateCharacterTool struct{}
CreateCharacterTool 创建新角色。
func (*CreateCharacterTool) Category ¶
func (t *CreateCharacterTool) Category() ToolCategory
func (*CreateCharacterTool) Description ¶
func (t *CreateCharacterTool) Description() string
func (*CreateCharacterTool) Execute ¶
func (t *CreateCharacterTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateCharacterTool) ExposeToLLM ¶
func (t *CreateCharacterTool) ExposeToLLM() bool
func (*CreateCharacterTool) JSONSchema ¶
func (t *CreateCharacterTool) JSONSchema() json.RawMessage
func (*CreateCharacterTool) Name ¶
func (t *CreateCharacterTool) Name() string
func (*CreateCharacterTool) NewArgs ¶
func (t *CreateCharacterTool) NewArgs() any
type CreateLocationArgs ¶
type CreateLocationArgs struct {
Locations []CreateLocationItem `` /* 126-byte string literal not displayed */
}
CreateLocationArgs 是 create_location 的参数。
type CreateLocationItem ¶
type CreateLocationItem struct {
Name string `json:"name" jsonschema:"required,description=地点名称" validate:"required"`
LocationType string `json:"location_type" jsonschema:"description=地点类型,自由文本,如'森林'、'城市'、'洞穴'"`
Description string `json:"description" jsonschema:"description=环境氛围、特色等描述"`
DetailJSON string `` /* 126-byte string literal not displayed */
Tags string `json:"tags" jsonschema:"description=字符串形式的JSON数组,自由标签,如[\"危险\",\"神秘\"]"`
ParentLocationID *int64 `json:"parent_location_id" jsonschema:"description=父级地点ID,用于构建层级树"`
}
CreateLocationItem 是 create_location 的单条参数。
type CreateLocationRelationArgs ¶
type CreateLocationRelationArgs struct {
Relations []CreateLocationRelationItem `` /* 126-byte string literal not displayed */
}
CreateLocationRelationArgs 是 create_location_relation 的参数。
type CreateLocationRelationItem ¶
type CreateLocationRelationItem struct {
LocationA int64 `json:"location_a_id" jsonschema:"required,description=地点A的ID" validate:"required,min=1"`
LocationB int64 `json:"location_b_id" jsonschema:"required,description=地点B的ID" validate:"required,min=1"`
RelationType string `json:"relation_type" jsonschema:"required,description=空间关系描述,如'相邻''由山路连通'" validate:"required"`
Description string `json:"description" jsonschema:"description=补充细节"`
}
CreateLocationRelationItem 是 create_location_relation 的单条参数。
type CreateLocationRelationTool ¶
type CreateLocationRelationTool struct{}
CreateLocationRelationTool 创建地点之间的无向空间关系边。
func (*CreateLocationRelationTool) Category ¶
func (t *CreateLocationRelationTool) Category() ToolCategory
func (*CreateLocationRelationTool) Description ¶
func (t *CreateLocationRelationTool) Description() string
func (*CreateLocationRelationTool) Execute ¶
func (t *CreateLocationRelationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateLocationRelationTool) ExposeToLLM ¶
func (t *CreateLocationRelationTool) ExposeToLLM() bool
func (*CreateLocationRelationTool) JSONSchema ¶
func (t *CreateLocationRelationTool) JSONSchema() json.RawMessage
func (*CreateLocationRelationTool) Name ¶
func (t *CreateLocationRelationTool) Name() string
func (*CreateLocationRelationTool) NewArgs ¶
func (t *CreateLocationRelationTool) NewArgs() any
type CreateLocationTool ¶
type CreateLocationTool struct{}
CreateLocationTool 创建新地点。
func (*CreateLocationTool) Category ¶
func (t *CreateLocationTool) Category() ToolCategory
func (*CreateLocationTool) Description ¶
func (t *CreateLocationTool) Description() string
func (*CreateLocationTool) Execute ¶
func (t *CreateLocationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateLocationTool) ExposeToLLM ¶
func (t *CreateLocationTool) ExposeToLLM() bool
func (*CreateLocationTool) JSONSchema ¶
func (t *CreateLocationTool) JSONSchema() json.RawMessage
func (*CreateLocationTool) Name ¶
func (t *CreateLocationTool) Name() string
func (*CreateLocationTool) NewArgs ¶
func (t *CreateLocationTool) NewArgs() any
type CreateReaderPerspectiveEntryArgs ¶
type CreateReaderPerspectiveEntryArgs struct {
Entries []CreateReaderPerspectiveEntryItem `` /* 130-byte string literal not displayed */
}
CreateReaderPerspectiveEntryArgs 是 create_reader_perspective_entry 的参数。
type CreateReaderPerspectiveEntryItem ¶
type CreateReaderPerspectiveEntryItem struct {
Type string `` /* 157-byte string literal not displayed */
Content string `json:"content" jsonschema:"required,description=内容描述" validate:"required"`
PlantedChapter int `json:"planted_chapter" jsonschema:"required,description=种下的章节号" validate:"required,min=1"`
RelatedTruth string `json:"related_truth" jsonschema:"description=仅 misconception:真实情况是什么"`
}
CreateReaderPerspectiveEntryItem 是 create_reader_perspective_entry 的单条参数。
type CreateReaderPerspectiveEntryTool ¶
type CreateReaderPerspectiveEntryTool struct{}
CreateReaderPerspectiveEntryTool 创建一条读者认知条目。
func (*CreateReaderPerspectiveEntryTool) Category ¶
func (t *CreateReaderPerspectiveEntryTool) Category() ToolCategory
func (*CreateReaderPerspectiveEntryTool) Description ¶
func (t *CreateReaderPerspectiveEntryTool) Description() string
func (*CreateReaderPerspectiveEntryTool) Execute ¶
func (t *CreateReaderPerspectiveEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateReaderPerspectiveEntryTool) ExposeToLLM ¶
func (t *CreateReaderPerspectiveEntryTool) ExposeToLLM() bool
func (*CreateReaderPerspectiveEntryTool) JSONSchema ¶
func (t *CreateReaderPerspectiveEntryTool) JSONSchema() json.RawMessage
func (*CreateReaderPerspectiveEntryTool) Name ¶
func (t *CreateReaderPerspectiveEntryTool) Name() string
func (*CreateReaderPerspectiveEntryTool) NewArgs ¶
func (t *CreateReaderPerspectiveEntryTool) NewArgs() any
type CreateStoryArcArgs ¶
type CreateStoryArcArgs struct {
StoryArcs []CreateStoryArcItem `json:"story_arcs" jsonschema:"required,description=要创建的弧线列表(1-5个)" validate:"required,min=1,max=5,dive"`
}
CreateStoryArcArgs 是 create_story_arc 的参数。
type CreateStoryArcItem ¶
type CreateStoryArcItem struct {
Name string `json:"name" jsonschema:"required,description=弧线名称,如'复仇之路'" validate:"required"`
ArcType string `` /* 168-byte string literal not displayed */
Description string `json:"description" jsonschema:"description=弧线整体描述"`
Importance int `` /* 127-byte string literal not displayed */
}
CreateStoryArcItem 是 create_story_arc 的单条参数。
type CreateStoryArcTool ¶
type CreateStoryArcTool struct{}
CreateStoryArcTool 创建新叙事弧线。
func (*CreateStoryArcTool) Category ¶
func (t *CreateStoryArcTool) Category() ToolCategory
func (*CreateStoryArcTool) Description ¶
func (t *CreateStoryArcTool) Description() string
func (*CreateStoryArcTool) Execute ¶
func (t *CreateStoryArcTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateStoryArcTool) ExposeToLLM ¶
func (t *CreateStoryArcTool) ExposeToLLM() bool
func (*CreateStoryArcTool) JSONSchema ¶
func (t *CreateStoryArcTool) JSONSchema() json.RawMessage
func (*CreateStoryArcTool) Name ¶
func (t *CreateStoryArcTool) Name() string
func (*CreateStoryArcTool) NewArgs ¶
func (t *CreateStoryArcTool) NewArgs() any
type CreateTimelineEntryArgs ¶
type CreateTimelineEntryArgs struct {
Entries []CreateTimelineEntryItem `json:"entries" jsonschema:"required,description=要添加的条目列表(1-6个)" validate:"required,min=1,max=6,dive"`
}
CreateTimelineEntryArgs 是 create_timeline_entry 的参数。
type CreateTimelineEntryItem ¶
type CreateTimelineEntryItem struct {
Category string `` /* 156-byte string literal not displayed */
Title string `json:"title" jsonschema:"required,description=简短标题" validate:"required"`
Content string `json:"content" jsonschema:"description=详细描述"`
DetailJSON string `json:"detail_json" jsonschema:"description=字符串形式的JSON,结构化数据"`
TargetChapter int `` /* 152-byte string literal not displayed */
Importance int `` /* 126-byte string literal not displayed */
SourceChapter int `json:"source_chapter" jsonschema:"description=在哪章创建/埋下的"`
Source string `json:"source" jsonschema:"description=来源,default=ai"`
}
CreateTimelineEntryItem 是单条伏笔/用户指令的创建参数。
type CreateTimelineEntryTool ¶
type CreateTimelineEntryTool struct{}
CreateTimelineEntryTool 批量创建伏笔和用户指令。
func (*CreateTimelineEntryTool) Category ¶
func (t *CreateTimelineEntryTool) Category() ToolCategory
func (*CreateTimelineEntryTool) Description ¶
func (t *CreateTimelineEntryTool) Description() string
func (*CreateTimelineEntryTool) Execute ¶
func (t *CreateTimelineEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*CreateTimelineEntryTool) ExposeToLLM ¶
func (t *CreateTimelineEntryTool) ExposeToLLM() bool
func (*CreateTimelineEntryTool) JSONSchema ¶
func (t *CreateTimelineEntryTool) JSONSchema() json.RawMessage
func (*CreateTimelineEntryTool) Name ¶
func (t *CreateTimelineEntryTool) Name() string
func (*CreateTimelineEntryTool) NewArgs ¶
func (t *CreateTimelineEntryTool) NewArgs() any
type DeleteRecordArgs ¶
type DeleteRecordArgs struct {
Table string `` /* 409-byte string literal not displayed */
ID int64 `` /* 144-byte string literal not displayed */
}
DeleteRecordArgs 是 delete_record 的参数。
type DeleteRecordTool ¶
type DeleteRecordTool struct{}
DeleteRecordTool 统一删除任意表的单条记录。
func (*DeleteRecordTool) Category ¶
func (t *DeleteRecordTool) Category() ToolCategory
func (*DeleteRecordTool) Description ¶
func (t *DeleteRecordTool) Description() string
func (*DeleteRecordTool) Execute ¶
func (t *DeleteRecordTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*DeleteRecordTool) ExposeToLLM ¶
func (t *DeleteRecordTool) ExposeToLLM() bool
func (*DeleteRecordTool) JSONSchema ¶
func (t *DeleteRecordTool) JSONSchema() json.RawMessage
func (*DeleteRecordTool) Name ¶
func (t *DeleteRecordTool) Name() string
func (*DeleteRecordTool) NewArgs ¶
func (t *DeleteRecordTool) NewArgs() any
type DisplayInfo ¶
DisplayInfo 是某个阶段的前端展示信息。
type DisplayPhase ¶
type DisplayPhase int
DisplayPhase 表示工具展示所处的阶段。
const ( PhaseSelected DisplayPhase = iota // 工具被选中 PhaseExecuting // 正在执行 PhaseCompleted // 执行成功 PhaseFailed // 执行失败 PhaseCancelled // 用户取消 )
type EditArgs ¶
type EditArgs struct {
Path string `` /* 305-byte string literal not displayed */
ChangeType string `` /* 322-byte string literal not displayed */
SearchText string `` /* 149-byte string literal not displayed */
NewContent string `` /* 423-byte string literal not displayed */
ReplaceAll bool `` /* 137-byte string literal not displayed */
StartLine int `` /* 155-byte string literal not displayed */
EndLine int `` /* 132-byte string literal not displayed */
Reason string `` /* 129-byte string literal not displayed */
Title string `` /* 192-byte string literal not displayed */
}
EditArgs 是 edit 工具的参数。
type EditTool ¶
type EditTool struct{}
EditTool 编辑文件(章节或故事状态),支持全文替换、查找替换、行范围替换。 修改在内存中完成后生成 git diff 提交审批,通过后写入文件。
func (*EditTool) Category ¶
func (t *EditTool) Category() ToolCategory
func (*EditTool) Description ¶
func (*EditTool) Execute ¶
func (t *EditTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*EditTool) ExposeToLLM ¶
func (*EditTool) JSONSchema ¶
func (t *EditTool) JSONSchema() json.RawMessage
type ErrKind ¶
type ErrKind string
ErrKind 标记工具失败的类别,供 agent 层决定中断/重试策略。
取值含义: - ErrKindBusiness: 业务错误(实体不存在、状态冲突等),LLM 换参数/换路径可能成功,不计入中断 - ErrKindSystem: 系统错误(DB/网络/panic),重试可能恢复 - ErrKindArgs: 参数错误(格式不正确/校验失败),LLM 不会正确使用此工具,连续多次应中断
type GetChapterListArgs ¶
type GetChapterListArgs struct {
PageArgs // 嵌入分页参数
}
GetChapterListArgs 是 get_chapter_list 的参数。
type GetChapterListTool ¶
type GetChapterListTool struct{}
GetChapterListTool 获取章节列表,按章节号降序。
func (*GetChapterListTool) Category ¶
func (t *GetChapterListTool) Category() ToolCategory
func (*GetChapterListTool) Description ¶
func (t *GetChapterListTool) Description() string
func (*GetChapterListTool) Execute ¶
func (t *GetChapterListTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetChapterListTool) ExposeToLLM ¶
func (t *GetChapterListTool) ExposeToLLM() bool
func (*GetChapterListTool) JSONSchema ¶
func (t *GetChapterListTool) JSONSchema() json.RawMessage
func (*GetChapterListTool) Name ¶
func (t *GetChapterListTool) Name() string
func (*GetChapterListTool) NewArgs ¶
func (t *GetChapterListTool) NewArgs() any
type GetCharacterRelationsArgs ¶
type GetCharacterRelationsArgs struct {
CharacterIDs []int64 `` /* 137-byte string literal not displayed */
}
GetCharacterRelationsArgs 是 get_character_relations 的参数。
type GetCharacterRelationsTool ¶
type GetCharacterRelationsTool struct{}
GetCharacterRelationsTool 返回给定角色集合内部的子图边。
func (*GetCharacterRelationsTool) Category ¶
func (t *GetCharacterRelationsTool) Category() ToolCategory
func (*GetCharacterRelationsTool) Description ¶
func (t *GetCharacterRelationsTool) Description() string
func (*GetCharacterRelationsTool) Execute ¶
func (t *GetCharacterRelationsTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetCharacterRelationsTool) ExposeToLLM ¶
func (t *GetCharacterRelationsTool) ExposeToLLM() bool
func (*GetCharacterRelationsTool) JSONSchema ¶
func (t *GetCharacterRelationsTool) JSONSchema() json.RawMessage
func (*GetCharacterRelationsTool) Name ¶
func (t *GetCharacterRelationsTool) Name() string
func (*GetCharacterRelationsTool) NewArgs ¶
func (t *GetCharacterRelationsTool) NewArgs() any
type GetCharactersArgs ¶
type GetCharactersArgs struct {
Search string `json:"search" jsonschema:"description=角色名模糊搜索"`
PageArgs // 嵌入分页参数
}
GetCharactersArgs 是 get_characters 的参数。
type GetCharactersTool ¶
type GetCharactersTool struct{}
GetCharactersTool 获取角色列表,截断 50 条,冷角色靠搜索。
func (*GetCharactersTool) Category ¶
func (t *GetCharactersTool) Category() ToolCategory
func (*GetCharactersTool) Description ¶
func (t *GetCharactersTool) Description() string
func (*GetCharactersTool) Execute ¶
func (t *GetCharactersTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetCharactersTool) ExposeToLLM ¶
func (t *GetCharactersTool) ExposeToLLM() bool
func (*GetCharactersTool) JSONSchema ¶
func (t *GetCharactersTool) JSONSchema() json.RawMessage
func (*GetCharactersTool) Name ¶
func (t *GetCharactersTool) Name() string
func (*GetCharactersTool) NewArgs ¶
func (t *GetCharactersTool) NewArgs() any
type GetLocationsArgs ¶
type GetLocationsArgs struct {
Mode string `` /* 195-byte string literal not displayed */
LocationID int64 `` /* 170-byte string literal not displayed */
LocationType string `json:"location_type" jsonschema:"description=按类型筛选(list模式可选)"`
Search string `json:"search" jsonschema:"description=按名称搜索(list模式可选)"`
PageArgs // 嵌入分页参数
}
GetLocationsArgs 是 get_locations 的参数。
type GetLocationsTool ¶
type GetLocationsTool struct{}
GetLocationsTool 获取地点信息,支持三种模式。
func (*GetLocationsTool) Category ¶
func (t *GetLocationsTool) Category() ToolCategory
func (*GetLocationsTool) Description ¶
func (t *GetLocationsTool) Description() string
func (*GetLocationsTool) Execute ¶
func (t *GetLocationsTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetLocationsTool) ExposeToLLM ¶
func (t *GetLocationsTool) ExposeToLLM() bool
func (*GetLocationsTool) JSONSchema ¶
func (t *GetLocationsTool) JSONSchema() json.RawMessage
func (*GetLocationsTool) Name ¶
func (t *GetLocationsTool) Name() string
func (*GetLocationsTool) NewArgs ¶
func (t *GetLocationsTool) NewArgs() any
type GetReaderPerspectiveArgs ¶
type GetReaderPerspectiveArgs struct{}
GetReaderPerspectiveArgs 无参——LLM 按需调用即可。
type GetReaderPerspectiveTool ¶
type GetReaderPerspectiveTool struct{}
GetReaderPerspectiveTool 返回读者当前认知状态的三段式摘要。 known 兜底截断 60 条——完整认知上下文只需最近的关键事实。
func (*GetReaderPerspectiveTool) Category ¶
func (t *GetReaderPerspectiveTool) Category() ToolCategory
func (*GetReaderPerspectiveTool) Description ¶
func (t *GetReaderPerspectiveTool) Description() string
func (*GetReaderPerspectiveTool) Execute ¶
func (t *GetReaderPerspectiveTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetReaderPerspectiveTool) ExposeToLLM ¶
func (t *GetReaderPerspectiveTool) ExposeToLLM() bool
func (*GetReaderPerspectiveTool) JSONSchema ¶
func (t *GetReaderPerspectiveTool) JSONSchema() json.RawMessage
func (*GetReaderPerspectiveTool) Name ¶
func (t *GetReaderPerspectiveTool) Name() string
func (*GetReaderPerspectiveTool) NewArgs ¶
func (t *GetReaderPerspectiveTool) NewArgs() any
type GetStoryArcsArgs ¶
type GetStoryArcsArgs struct {
CurrentChapter int `` /* 210-byte string literal not displayed */
ArcType string `` /* 163-byte string literal not displayed */
Status string `` /* 169-byte string literal not displayed */
PageArgs // 嵌入分页参数(仅不传 current_chapter 时生效)
}
GetStoryArcsArgs 是 get_story_arcs 的参数。
type GetStoryArcsTool ¶
type GetStoryArcsTool struct{}
GetStoryArcsTool 获取叙事弧线及节点链。
func (*GetStoryArcsTool) Category ¶
func (t *GetStoryArcsTool) Category() ToolCategory
func (*GetStoryArcsTool) Description ¶
func (t *GetStoryArcsTool) Description() string
func (*GetStoryArcsTool) Execute ¶
func (t *GetStoryArcsTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetStoryArcsTool) ExposeToLLM ¶
func (t *GetStoryArcsTool) ExposeToLLM() bool
func (*GetStoryArcsTool) JSONSchema ¶
func (t *GetStoryArcsTool) JSONSchema() json.RawMessage
func (*GetStoryArcsTool) Name ¶
func (t *GetStoryArcsTool) Name() string
func (*GetStoryArcsTool) NewArgs ¶
func (t *GetStoryArcsTool) NewArgs() any
type GetTimelineArgs ¶
type GetTimelineArgs struct {
CurrentChapter int `` /* 162-byte string literal not displayed */
Category string `` /* 151-byte string literal not displayed */
Status string `` /* 150-byte string literal not displayed */
Search string `json:"search" jsonschema:"description=按标题或内容模糊搜索(仅不传 current_chapter 时生效)"`
PageArgs // 嵌入分页参数(仅不传 current_chapter 时生效)
}
GetTimelineArgs 是 get_timeline 的参数。
type GetTimelineTool ¶
type GetTimelineTool struct{}
GetTimelineTool 获取章节计划 + 伏笔/用户指令总览。
func (*GetTimelineTool) Category ¶
func (t *GetTimelineTool) Category() ToolCategory
func (*GetTimelineTool) Description ¶
func (t *GetTimelineTool) Description() string
func (*GetTimelineTool) Execute ¶
func (t *GetTimelineTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*GetTimelineTool) ExposeToLLM ¶
func (t *GetTimelineTool) ExposeToLLM() bool
func (*GetTimelineTool) JSONSchema ¶
func (t *GetTimelineTool) JSONSchema() json.RawMessage
func (*GetTimelineTool) Name ¶
func (t *GetTimelineTool) Name() string
func (*GetTimelineTool) NewArgs ¶
func (t *GetTimelineTool) NewArgs() any
type InjectMessage ¶
type InjectMessage struct {
Role string `json:"role"` // "user" | "system"
Content string `json:"content"`
}
InjectMessage 由工具返回,agent loop 会后追加到对话流。固定 to_api=true, to_frontend=false。
type PageArgs ¶
type PageArgs struct {
Page int `json:"page" jsonschema:"description=页码,default=1,minimum=1" validate:"omitempty,min=1"`
Size int `json:"size" jsonschema:"description=每页数量,default=50,minimum=1,maximum=100" validate:"omitempty,min=1,max=100"`
}
PageArgs 是分页查询的公共参数,嵌入 Args 结构体即可。
type ReadArgs ¶
type ReadArgs struct {
Path string `` /* 354-byte string literal not displayed */
IncludeLines *bool `` /* 178-byte string literal not displayed */
StartLine int `` /* 131-byte string literal not displayed */
EndLine int `` /* 180-byte string literal not displayed */
}
ReadArgs 是 read 工具的参数。
type ReadTool ¶
type ReadTool struct{}
ReadTool 读取文件内容(章节正文或故事状态 goink.md)。 默认含行号前缀(123|),LLM 传 include_lines=false 获取纯文本。 start_line/end_line 支持行范围读取,用于翻页和精确引用。
func (*ReadTool) Category ¶
func (t *ReadTool) Category() ToolCategory
func (*ReadTool) Description ¶
func (*ReadTool) Execute ¶
func (t *ReadTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*ReadTool) ExposeToLLM ¶
func (*ReadTool) JSONSchema ¶
func (t *ReadTool) JSONSchema() json.RawMessage
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 是 MCP 工具注册表,无全局单例,由 main.go 创建后注入。
func (*Registry) Execute ¶
func (r *Registry) Execute(ctx context.Context, name string, rawArgs json.RawMessage, tc ToolContext, allowed map[string]bool) *ToolResult
Execute 查表 → 白名单校验 → 反序列化 + validate → 调 Tool.Execute → 兜底 panic + 错误。 allowed=nil 表示不限制;非 nil 只放行白名单内的工具。
func (*Registry) ListByCategory ¶
ListByCategory 按 category 分组返回全部工具信息,供管理端展示。
type RunSubAgentFunc ¶
type RunSubAgentFunc func(ctx context.Context, req SubAgentRequest) (report string, err error)
RunSubAgentFunc 由 agent 包注入,避免循环依赖。
type RunSubagentArgs ¶
type RunSubagentArgs struct {
AgentType string `` /* 249-byte string literal not displayed */
Instruction string `` /* 137-byte string literal not displayed */
}
RunSubagentArgs 是 run_subagent 的参数。
type RunSubagentTool ¶
type RunSubagentTool struct{}
RunSubagentTool 启动子 Agent 执行专项任务,返回最终报告。
func (*RunSubagentTool) Category ¶
func (t *RunSubagentTool) Category() ToolCategory
func (*RunSubagentTool) Description ¶
func (t *RunSubagentTool) Description() string
func (*RunSubagentTool) Execute ¶
func (t *RunSubagentTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*RunSubagentTool) ExposeToLLM ¶
func (t *RunSubagentTool) ExposeToLLM() bool
func (*RunSubagentTool) JSONSchema ¶
func (t *RunSubagentTool) JSONSchema() json.RawMessage
func (*RunSubagentTool) Name ¶
func (t *RunSubagentTool) Name() string
func (*RunSubagentTool) NewArgs ¶
func (t *RunSubagentTool) NewArgs() any
type SearchStoryMemoryArgs ¶
type SearchStoryMemoryArgs struct {
Query string `` /* 127-byte string literal not displayed */
TopK int `json:"top_k" jsonschema:"description=返回结果数量,default=5,minimum=1,maximum=20" validate:"omitempty,min=1,max=20"`
MinRelevance float64 `json:"min_relevance" jsonschema:"description=相关度阈值 0-1,default=0.5" validate:"omitempty,min=0,max=1"`
ChapterNumbers []int `json:"chapter_numbers" jsonschema:"description=限定章节号范围,空表示不限制"`
ChunkTypes []string `` /* 155-byte string literal not displayed */
}
SearchStoryMemoryArgs 是 search_story_memory 的参数。
type SearchStoryMemoryTool ¶
type SearchStoryMemoryTool struct{}
SearchStoryMemoryTool 语义检索小说记忆。
func (*SearchStoryMemoryTool) Category ¶
func (t *SearchStoryMemoryTool) Category() ToolCategory
func (*SearchStoryMemoryTool) Description ¶
func (t *SearchStoryMemoryTool) Description() string
func (*SearchStoryMemoryTool) Execute ¶
func (t *SearchStoryMemoryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*SearchStoryMemoryTool) ExposeToLLM ¶
func (t *SearchStoryMemoryTool) ExposeToLLM() bool
func (*SearchStoryMemoryTool) JSONSchema ¶
func (t *SearchStoryMemoryTool) JSONSchema() json.RawMessage
func (*SearchStoryMemoryTool) Name ¶
func (t *SearchStoryMemoryTool) Name() string
func (*SearchStoryMemoryTool) NewArgs ¶
func (t *SearchStoryMemoryTool) NewArgs() any
type SubAgentRequest ¶
type SubAgentRequest struct {
AgentType string // "memory" | "review"
NovelID int64
ToolID string // run_subagent 的 tool call ID,子 Agent 事件路由用
Instruction string
}
SubAgentRequest 传递给子 Agent 运行器的参数。
type Tool ¶
type Tool interface {
Name() string
Description() string
Category() ToolCategory
JSONSchema() json.RawMessage
ExposeToLLM() bool
NewArgs() any // 返回零值 args 指针,供 Registry 反序列化 + 校验用
Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
}
Tool 是每个 MCP 工具实现的接口。
type ToolCategory ¶
type ToolCategory string
ToolCategory 是工具分类,仅作组织用途。
const ( CategoryNovelManagement ToolCategory = "novel_management" CategoryMemoryRetrieval ToolCategory = "memory_retrieval" CategoryConsistencyCheck ToolCategory = "consistency_check" CategoryWritingAssistant ToolCategory = "writing_assistant" )
type ToolContext ¶
type ToolContext struct {
DB *gorm.DB
NovelID int64
ToolID string
RawArgs json.RawMessage // 原始 JSON,update 工具用于 PATCH DB 实体
Approver approval.Approver // 审批能力,nil 表示工具无需审批
EmitApproval func(toolID string, approvalType string, payload map[string]any) // 向 agent 事件流推送审批事件(EventToolCall, phase="awaiting_approval")
RunSubAgent RunSubAgentFunc // 子 Agent 运行器,由 agent 包注入
SkillStore *skill.Store // 技能存储,read 工具用于读取内置 skill
SearchService *search.Service // 搜索服务,write 工具用于更新正文缓存
WebSearch func(ctx context.Context, query string) (*llm.WebSearchResult, error) // 网络搜索,由 agent 注入 DeepSeek 闭包;nil 表示未配置
Logger *slog.Logger // 项目 logger,由 agent 注入;nil 时走 slog.Default()
}
ToolContext 是工具执行时注入的上下文。
func (ToolContext) LoggerOrDefault ¶
func (tc ToolContext) LoggerOrDefault() *slog.Logger
LoggerOrDefault 返回 ToolContext 的 Logger,nil 时兜底到 slog.Default()。 兜底用于测试场景(ToolContext{} 零值),生产路径 agent.go 会注入非 nil logger。 配合 main.go 的 slog.SetDefault(log),即使 nil 兜底也走项目 logger 配置。
type ToolInfo ¶
type ToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
}
ToolInfo 是工具的公开元信息。
type ToolResult ¶
type ToolResult struct {
Success bool `json:"success"`
Data map[string]any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
ErrKind ErrKind `json:"err_kind,omitempty"` // 取值见 ErrKind 常量
Metadata map[string]any `json:"metadata,omitempty"`
Inject []InjectMessage `json:"inject,omitempty"`
}
ToolResult 是工具执行结果。
type UpdateArcNodeArgs ¶
type UpdateArcNodeArgs struct {
NodeID int64 `json:"node_id" jsonschema:"required,description=节点ID" validate:"required,min=1"`
Title string `json:"title" jsonschema:"description=新的标题"`
Description string `json:"description" jsonschema:"description=新的描述"`
TargetChapter int `json:"target_chapter" jsonschema:"description=新的目标章节号,minimum=1" validate:"omitempty,min=1"`
ActualChapter int `json:"actual_chapter" jsonschema:"description=实际发生的章节号(标记完成时填入)"`
Status string `` /* 146-byte string literal not displayed */
}
UpdateArcNodeArgs 是 update_arc_node 的参数。
type UpdateArcNodeTool ¶
type UpdateArcNodeTool struct{}
UpdateArcNodeTool 更新弧线节点(PATCH 语义)。
func (*UpdateArcNodeTool) Category ¶
func (t *UpdateArcNodeTool) Category() ToolCategory
func (*UpdateArcNodeTool) Description ¶
func (t *UpdateArcNodeTool) Description() string
func (*UpdateArcNodeTool) Execute ¶
func (t *UpdateArcNodeTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateArcNodeTool) ExposeToLLM ¶
func (t *UpdateArcNodeTool) ExposeToLLM() bool
func (*UpdateArcNodeTool) JSONSchema ¶
func (t *UpdateArcNodeTool) JSONSchema() json.RawMessage
func (*UpdateArcNodeTool) Name ¶
func (t *UpdateArcNodeTool) Name() string
func (*UpdateArcNodeTool) NewArgs ¶
func (t *UpdateArcNodeTool) NewArgs() any
type UpdateChapterPlanArgs ¶
type UpdateChapterPlanArgs struct {
Scope string `` /* 128-byte string literal not displayed */
Content string `json:"content" jsonschema:"required,description=计划内容,自然语言描述" validate:"required"`
}
UpdateChapterPlanArgs 是 update_chapter_plan 的参数。
type UpdateChapterPlanTool ¶
type UpdateChapterPlanTool struct{}
UpdateChapterPlanTool 更新章节创作计划。
func (*UpdateChapterPlanTool) Category ¶
func (t *UpdateChapterPlanTool) Category() ToolCategory
func (*UpdateChapterPlanTool) Description ¶
func (t *UpdateChapterPlanTool) Description() string
func (*UpdateChapterPlanTool) Execute ¶
func (t *UpdateChapterPlanTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateChapterPlanTool) ExposeToLLM ¶
func (t *UpdateChapterPlanTool) ExposeToLLM() bool
func (*UpdateChapterPlanTool) JSONSchema ¶
func (t *UpdateChapterPlanTool) JSONSchema() json.RawMessage
func (*UpdateChapterPlanTool) Name ¶
func (t *UpdateChapterPlanTool) Name() string
func (*UpdateChapterPlanTool) NewArgs ¶
func (t *UpdateChapterPlanTool) NewArgs() any
type UpdateCharacterArgs ¶
type UpdateCharacterArgs struct {
CharacterID int64 `json:"character_id" jsonschema:"required,description=角色ID" validate:"required,min=1"`
Name string `json:"name" jsonschema:"description=新的名称"`
Description string `json:"description" jsonschema:"description=新的自然语言描述(完全替换旧的)"`
Personality string `json:"personality" jsonschema:"description=新的性格/设定,字符串形式JSON(完全替换旧的)"`
Abilities string `json:"abilities" jsonschema:"description=新的能力列表,字符串形式JSON(完全替换旧的)"`
}
UpdateCharacterArgs 是 update_character 的参数。
type UpdateCharacterRelationshipArgs ¶
type UpdateCharacterRelationshipArgs struct {
RelationID int64 `json:"relation_id" jsonschema:"description=编辑已有关系时提供此ID,直接修改描述内容"`
SourceCharacterID int64 `json:"source_character_id" jsonschema:"description=建立新关系时的发出方角色ID。旧关系自动变为历史"`
TargetCharacterID int64 `json:"target_character_id" jsonschema:"description=建立新关系时的接收方角色ID。旧关系自动变为历史"`
RelationDescribe string `` /* 174-byte string literal not displayed */
Description string `json:"description" jsonschema:"description=当前关系阶段的详细描述"`
ChapterNumber int `json:"chapter_number" jsonschema:"description=此关系确立/变化的章节号"`
}
UpdateCharacterRelationshipArgs 是 update_character_relationship 的参数。
type UpdateCharacterRelationshipTool ¶
type UpdateCharacterRelationshipTool struct{}
UpdateCharacterRelationshipTool 创建或更新角色关系。
func (*UpdateCharacterRelationshipTool) Category ¶
func (t *UpdateCharacterRelationshipTool) Category() ToolCategory
func (*UpdateCharacterRelationshipTool) Description ¶
func (t *UpdateCharacterRelationshipTool) Description() string
func (*UpdateCharacterRelationshipTool) Execute ¶
func (t *UpdateCharacterRelationshipTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateCharacterRelationshipTool) ExposeToLLM ¶
func (t *UpdateCharacterRelationshipTool) ExposeToLLM() bool
func (*UpdateCharacterRelationshipTool) JSONSchema ¶
func (t *UpdateCharacterRelationshipTool) JSONSchema() json.RawMessage
func (*UpdateCharacterRelationshipTool) Name ¶
func (t *UpdateCharacterRelationshipTool) Name() string
func (*UpdateCharacterRelationshipTool) NewArgs ¶
func (t *UpdateCharacterRelationshipTool) NewArgs() any
type UpdateCharacterTool ¶
type UpdateCharacterTool struct{}
UpdateCharacterTool 更新角色字段。
func (*UpdateCharacterTool) Category ¶
func (t *UpdateCharacterTool) Category() ToolCategory
func (*UpdateCharacterTool) Description ¶
func (t *UpdateCharacterTool) Description() string
func (*UpdateCharacterTool) Execute ¶
func (t *UpdateCharacterTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateCharacterTool) ExposeToLLM ¶
func (t *UpdateCharacterTool) ExposeToLLM() bool
func (*UpdateCharacterTool) JSONSchema ¶
func (t *UpdateCharacterTool) JSONSchema() json.RawMessage
func (*UpdateCharacterTool) Name ¶
func (t *UpdateCharacterTool) Name() string
func (*UpdateCharacterTool) NewArgs ¶
func (t *UpdateCharacterTool) NewArgs() any
type UpdateLocationArgs ¶
type UpdateLocationArgs struct {
LocationID int64 `json:"location_id" jsonschema:"required,description=地点ID" validate:"required,min=1"`
Name string `json:"name" jsonschema:"description=新的名称"`
LocationType string `json:"location_type" jsonschema:"description=新的类型"`
Description string `json:"description" jsonschema:"description=新的描述"`
DetailJSON string `json:"detail_json" jsonschema:"description=新的结构化信息,字符串形式JSON(完全替换旧的)"`
Tags string `json:"tags" jsonschema:"description=新的标签,字符串形式JSON数组(完全替换旧的)"`
ParentLocationID *int64 `json:"parent_location_id" jsonschema:"description=新的父级地点ID(不传不变,传null变根节点)"`
}
UpdateLocationArgs 是 update_location 的参数。
type UpdateLocationRelationArgs ¶
type UpdateLocationRelationArgs struct {
RelationID int64 `json:"relation_id" jsonschema:"required,description=关系边ID" validate:"required,min=1"`
RelationType string `json:"relation_type" jsonschema:"description=新的空间关系描述"`
Description string `json:"description" jsonschema:"description=新的补充细节"`
}
UpdateLocationRelationArgs 是 update_location_relation 的参数。
type UpdateLocationRelationTool ¶
type UpdateLocationRelationTool struct{}
UpdateLocationRelationTool 更新地点空间关系边(PATCH 语义)。
func (*UpdateLocationRelationTool) Category ¶
func (t *UpdateLocationRelationTool) Category() ToolCategory
func (*UpdateLocationRelationTool) Description ¶
func (t *UpdateLocationRelationTool) Description() string
func (*UpdateLocationRelationTool) Execute ¶
func (t *UpdateLocationRelationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateLocationRelationTool) ExposeToLLM ¶
func (t *UpdateLocationRelationTool) ExposeToLLM() bool
func (*UpdateLocationRelationTool) JSONSchema ¶
func (t *UpdateLocationRelationTool) JSONSchema() json.RawMessage
func (*UpdateLocationRelationTool) Name ¶
func (t *UpdateLocationRelationTool) Name() string
func (*UpdateLocationRelationTool) NewArgs ¶
func (t *UpdateLocationRelationTool) NewArgs() any
type UpdateLocationTool ¶
type UpdateLocationTool struct{}
UpdateLocationTool 更新地点字段。
func (*UpdateLocationTool) Category ¶
func (t *UpdateLocationTool) Category() ToolCategory
func (*UpdateLocationTool) Description ¶
func (t *UpdateLocationTool) Description() string
func (*UpdateLocationTool) Execute ¶
func (t *UpdateLocationTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateLocationTool) ExposeToLLM ¶
func (t *UpdateLocationTool) ExposeToLLM() bool
func (*UpdateLocationTool) JSONSchema ¶
func (t *UpdateLocationTool) JSONSchema() json.RawMessage
func (*UpdateLocationTool) Name ¶
func (t *UpdateLocationTool) Name() string
func (*UpdateLocationTool) NewArgs ¶
func (t *UpdateLocationTool) NewArgs() any
type UpdateReaderPerspectiveEntryArgs ¶
type UpdateReaderPerspectiveEntryArgs struct {
EntryID int `json:"entry_id" jsonschema:"required,description=要更新的条目 ID" validate:"required,min=1"`
Content string `json:"content" jsonschema:"description=更新后的完整内容描述"`
RevealedChapter int `` /* 163-byte string literal not displayed */
PlantedChapter int `json:"planted_chapter" jsonschema:"description=在哪章种下的章节号" validate:"omitempty,min=1"`
RelatedTruth string `json:"related_truth" jsonschema:"description=作者视角的真实情况(支持所有类型)"`
Type string `` /* 149-byte string literal not displayed */
}
UpdateReaderPerspectiveEntryArgs 是 update_reader_perspective_entry 的参数。
type UpdateReaderPerspectiveEntryTool ¶
type UpdateReaderPerspectiveEntryTool struct{}
UpdateReaderPerspectiveEntryTool 更新读者认知条目。
func (*UpdateReaderPerspectiveEntryTool) Category ¶
func (t *UpdateReaderPerspectiveEntryTool) Category() ToolCategory
func (*UpdateReaderPerspectiveEntryTool) Description ¶
func (t *UpdateReaderPerspectiveEntryTool) Description() string
func (*UpdateReaderPerspectiveEntryTool) Execute ¶
func (t *UpdateReaderPerspectiveEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateReaderPerspectiveEntryTool) ExposeToLLM ¶
func (t *UpdateReaderPerspectiveEntryTool) ExposeToLLM() bool
func (*UpdateReaderPerspectiveEntryTool) JSONSchema ¶
func (t *UpdateReaderPerspectiveEntryTool) JSONSchema() json.RawMessage
func (*UpdateReaderPerspectiveEntryTool) Name ¶
func (t *UpdateReaderPerspectiveEntryTool) Name() string
func (*UpdateReaderPerspectiveEntryTool) NewArgs ¶
func (t *UpdateReaderPerspectiveEntryTool) NewArgs() any
type UpdateStoryArcArgs ¶
type UpdateStoryArcArgs struct {
ArcID int64 `json:"arc_id" jsonschema:"required,description=弧线ID" validate:"required,min=1"`
Name string `json:"name" jsonschema:"description=新的弧线名称"`
Description string `json:"description" jsonschema:"description=新的描述"`
ArcType string `` /* 166-byte string literal not displayed */
Importance int `json:"importance" jsonschema:"description=新的重要度1-5,minimum=1,maximum=5"`
Status string `` /* 163-byte string literal not displayed */
ReactivateAt string `json:"reactivate_at" jsonschema:"description=暂停弧线的恢复条件,自然语言。状态改为paused时填写"`
}
UpdateStoryArcArgs 是 update_story_arc 的参数。
type UpdateStoryArcTool ¶
type UpdateStoryArcTool struct{}
UpdateStoryArcTool 更新叙事弧线元数据(PATCH 语义)。
func (*UpdateStoryArcTool) Category ¶
func (t *UpdateStoryArcTool) Category() ToolCategory
func (*UpdateStoryArcTool) Description ¶
func (t *UpdateStoryArcTool) Description() string
func (*UpdateStoryArcTool) Execute ¶
func (t *UpdateStoryArcTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateStoryArcTool) ExposeToLLM ¶
func (t *UpdateStoryArcTool) ExposeToLLM() bool
func (*UpdateStoryArcTool) JSONSchema ¶
func (t *UpdateStoryArcTool) JSONSchema() json.RawMessage
func (*UpdateStoryArcTool) Name ¶
func (t *UpdateStoryArcTool) Name() string
func (*UpdateStoryArcTool) NewArgs ¶
func (t *UpdateStoryArcTool) NewArgs() any
type UpdateTimelineEntryArgs ¶
type UpdateTimelineEntryArgs struct {
EntryID int64 `json:"entry_id" jsonschema:"required,description=条目ID" validate:"required,min=1"`
Title string `json:"title" jsonschema:"description=新的标题"`
Content string `json:"content" jsonschema:"description=新的描述"`
DetailJSON string `json:"detail_json" jsonschema:"description=新的结构化数据(完全替换旧的)"`
TargetChapter int `json:"target_chapter" jsonschema:"description=新的目标章节号,minimum=1" validate:"omitempty,min=1"`
Importance int `json:"importance" jsonschema:"description=新的重要度1-5,minimum=1,maximum=5"`
Status string `` /* 144-byte string literal not displayed */
ResolvedChapter int `json:"resolved_chapter" jsonschema:"description=在哪章回收(标记resolved时填入)"`
}
UpdateTimelineEntryArgs 是 update_timeline_entry 的参数。
type UpdateTimelineEntryTool ¶
type UpdateTimelineEntryTool struct{}
UpdateTimelineEntryTool 更新伏笔或用户指令。
func (*UpdateTimelineEntryTool) Category ¶
func (t *UpdateTimelineEntryTool) Category() ToolCategory
func (*UpdateTimelineEntryTool) Description ¶
func (t *UpdateTimelineEntryTool) Description() string
func (*UpdateTimelineEntryTool) Execute ¶
func (t *UpdateTimelineEntryTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpdateTimelineEntryTool) ExposeToLLM ¶
func (t *UpdateTimelineEntryTool) ExposeToLLM() bool
func (*UpdateTimelineEntryTool) JSONSchema ¶
func (t *UpdateTimelineEntryTool) JSONSchema() json.RawMessage
func (*UpdateTimelineEntryTool) Name ¶
func (t *UpdateTimelineEntryTool) Name() string
func (*UpdateTimelineEntryTool) NewArgs ¶
func (t *UpdateTimelineEntryTool) NewArgs() any
type UpsertPreferenceArgs ¶
type UpsertPreferenceArgs struct {
Preferences []UpsertPreferenceItem `` /* 164-byte string literal not displayed */
}
UpsertPreferenceArgs 是 upsert_preference 的参数。
type UpsertPreferenceItem ¶
type UpsertPreferenceItem struct {
PreferenceID *int64 `json:"preference_id,omitempty" jsonschema:"description=已存在偏好ID;不传=新建"`
Category string `json:"category" jsonschema:"required,description=偏好分类(自由文本标签)" validate:"required"`
Content string `json:"content" jsonschema:"required,description=偏好内容" validate:"required"`
IsGlobal *bool `` /* 141-byte string literal not displayed */
}
UpsertPreferenceItem 是 upsert_preference 的单条参数。
type UpsertPreferenceTool ¶
type UpsertPreferenceTool struct{}
UpsertPreferenceTool 批量 upsert 创作偏好(创建或更新,单事务原子性)。
func (*UpsertPreferenceTool) Category ¶
func (t *UpsertPreferenceTool) Category() ToolCategory
func (*UpsertPreferenceTool) Description ¶
func (t *UpsertPreferenceTool) Description() string
func (*UpsertPreferenceTool) Execute ¶
func (t *UpsertPreferenceTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpsertPreferenceTool) ExposeToLLM ¶
func (t *UpsertPreferenceTool) ExposeToLLM() bool
func (*UpsertPreferenceTool) JSONSchema ¶
func (t *UpsertPreferenceTool) JSONSchema() json.RawMessage
func (*UpsertPreferenceTool) Name ¶
func (t *UpsertPreferenceTool) Name() string
func (*UpsertPreferenceTool) NewArgs ¶
func (t *UpsertPreferenceTool) NewArgs() any
type UpsertSettingArgs ¶
type UpsertSettingArgs struct {
Settings []UpsertSettingItem `` /* 158-byte string literal not displayed */
}
UpsertSettingArgs 是 upsert_setting 的参数。
type UpsertSettingItem ¶
type UpsertSettingItem struct {
SettingID *int64 `json:"setting_id,omitempty" jsonschema:"description=已存在设定ID;不传=新建"`
Category string `` /* 152-byte string literal not displayed */
Content string `json:"content" jsonschema:"required,description=设定内容" validate:"required"`
}
UpsertSettingItem 是 upsert_setting 的单条参数。
type UpsertSettingTool ¶
type UpsertSettingTool struct{}
UpsertSettingTool 批量 upsert 世界观设定(创建或更新,单事务原子性)。
func (*UpsertSettingTool) Category ¶
func (t *UpsertSettingTool) Category() ToolCategory
func (*UpsertSettingTool) Description ¶
func (t *UpsertSettingTool) Description() string
func (*UpsertSettingTool) Execute ¶
func (t *UpsertSettingTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*UpsertSettingTool) ExposeToLLM ¶
func (t *UpsertSettingTool) ExposeToLLM() bool
func (*UpsertSettingTool) JSONSchema ¶
func (t *UpsertSettingTool) JSONSchema() json.RawMessage
func (*UpsertSettingTool) Name ¶
func (t *UpsertSettingTool) Name() string
func (*UpsertSettingTool) NewArgs ¶
func (t *UpsertSettingTool) NewArgs() any
type WebFetchArgs ¶
type WebFetchArgs struct {
URL string `json:"url" jsonschema:"required,description=要抓取的网页 URL" validate:"required,url,min=1,max=2048"`
}
WebFetchArgs 是 web_fetch 工具的参数。
type WebFetchTool ¶
type WebFetchTool struct{}
WebFetchTool 抓取网页内容,清洗后返回 markdown 格式正文。
func (*WebFetchTool) Category ¶
func (t *WebFetchTool) Category() ToolCategory
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*WebFetchTool) ExposeToLLM ¶
func (t *WebFetchTool) ExposeToLLM() bool
func (*WebFetchTool) JSONSchema ¶
func (t *WebFetchTool) JSONSchema() json.RawMessage
func (*WebFetchTool) Name ¶
func (t *WebFetchTool) Name() string
func (*WebFetchTool) NewArgs ¶
func (t *WebFetchTool) NewArgs() any
type WebSearchArgs ¶
type WebSearchArgs struct {
Prompt string `` /* 215-byte string literal not displayed */
}
WebSearchArgs 是 web_search 工具的参数。
type WebSearchTool ¶
type WebSearchTool struct{}
WebSearchTool 通过 DeepSeek Anthropic 端点执行网络搜索,返回模型总结和来源链接。
func (*WebSearchTool) Category ¶
func (t *WebSearchTool) Category() ToolCategory
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, args any, tc ToolContext) (*ToolResult, error)
func (*WebSearchTool) ExposeToLLM ¶
func (t *WebSearchTool) ExposeToLLM() bool
func (*WebSearchTool) JSONSchema ¶
func (t *WebSearchTool) JSONSchema() json.RawMessage
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) NewArgs ¶
func (t *WebSearchTool) NewArgs() any