greeter

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package greeter 是用 mcp-toolify 暴露工具的最小示例。 在函数 godoc 上加 `// mcp:tool` 再跑 `go generate`,它就成了一个 MCP 工具。

labels 的 key 语义由部署方的配置解释(基座不解释):本示例沿用 capability / risk 两个 key,与 example/conf/mcp.toml 里的 token 准入、 配额规则、二次确认规则一致。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNumbers

func AddNumbers(a int, b int) (sum int)

AddNumbers 返回两个整数之和(演示多返回值按变量名打包)。

param: a — 第一个加数 param: b — 第二个加数

mcp:tool mcp:labels=capability=read,risk=none

func Greet

func Greet(name string, excited bool) (string, error)

Greet 生成一句问候语。

param: name — 要问候的名字 param: excited — 是否在结尾加感叹号

mcp:tool mcp:labels=capability=read,risk=none

func Shout added in v0.5.0

func Shout(text string) (string, error)

Shout 把一句话改成全大写(示例里的「高危写操作」)。

它本身当然是无害的,标成 capability=write,risk=high 只是为了让示例真的走一遍 配额与二次确认:example/conf/mcp.toml 里的 [[quota.rules]] 与 [confirm] 都按 这两个 label 管辖,把它换成你自己那个真会改线上状态的函数即可。

param: text — 要改写的文本

mcp:tool mcp:labels=capability=write,risk=high

Types

This section is empty.

Jump to

Keyboard shortcuts

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