Skip to content

Commit e92ff45

Browse files
feat: Add WithServerInstructions() constructor.
1 parent 6f6550e commit e92ff45

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

examples/http_example/server/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ func main() {
1818
transport := http.NewHTTPTransport("/mcp").WithAddr(":8081")
1919

2020
// Create a new server with the transport
21-
server := mcp_golang.NewServer(transport, mcp_golang.WithName("mcp-golang-stateless-http-example"), mcp_golang.WithVersion("0.0.1"))
21+
server := mcp_golang.NewServer(
22+
transport,
23+
mcp_golang.WithName("mcp-golang-stateless-http-example"),
24+
mcp_golang.WithServerInstructions("A simple example of a stateless HTTP server using mcp-golang"),
25+
mcp_golang.WithVersion("0.0.1"),
26+
)
2227

2328
// Register a simple tool
2429
err := server.RegisterTool("time", "Returns the current time in the specified format", func(args TimeArgs) (*mcp_golang.ToolResponse, error) {

server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ func WithName(name string) ServerOptions {
155155
}
156156
}
157157

158+
func WithServerInstructions(instructions string) ServerOptions {
159+
return func(s *Server) {
160+
s.serverInstructions = &instructions
161+
}
162+
}
163+
158164
func WithVersion(version string) ServerOptions {
159165
return func(s *Server) {
160166
s.serverVersion = version

0 commit comments

Comments
 (0)