🎉 初始化项目

This commit is contained in:
2026-02-10 17:48:27 +08:00
parent f3da9c506a
commit db934ebed7
1575 changed files with 348967 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
package mcpTool
import (
"context"
"github.com/mark3labs/mcp-go/mcp"
)
func init() {
RegisterTool(&{{.Name | title}}{})
}
type {{.Name | title}} struct {
}
// {{.Description}}
func (t *{{.Name | title}}) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
// TODO:
// :
// {{- range .Params}}
// {{.Name}} := request.GetArguments()["{{.Name}}"]
// {{- end}}
return &mcp.CallToolResult{
Content: []mcp.Content{
{{- range .Response}}
mcp.{{.Type | title}}Content{
Type: "{{.Type}}",
// TODO: {{.Type}}
},
{{- end}}
},
}, nil
}
func (t *{{.Name | title}}) New() mcp.Tool {
return mcp.NewTool("{{.Name}}",
mcp.WithDescription("{{.Description}}"),
{{- range .Params}}
mcp.With{{.Type | title}}("{{.Name}}",
{{- if .Required}}mcp.Required(),{{end}}
mcp.Description("{{.Description}}"),
{{- if .Default}}
{{- if eq .Type "string"}}
mcp.DefaultString("{{.Default}}"),
{{- else if eq .Type "number"}}
mcp.DefaultNumber({{.Default}}),
{{- else if eq .Type "boolean"}}
mcp.DefaultBoolean({{if or (eq .Default "true") (eq .Default "True")}}true{{else}}false{{end}}),
{{- else if eq .Type "array"}}
//
// mcp.DefaultArray({{.Default}}),
{{- end}}
{{- end}}
),
{{- end}}
)
}