Skip to content

Commit 72aa9d8

Browse files
More structure changes
1 parent 17c4b2e commit 72aa9d8

File tree

4 files changed

+41
-233
lines changed

4 files changed

+41
-233
lines changed

cmd/main.go

Lines changed: 0 additions & 232 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/metoro-io/mcp-golang/server"
6+
"github.com/metoro-io/mcp-golang/server/tools"
7+
"github.com/metoro-io/mcp-golang/transport/stdio"
8+
)
9+
10+
type Content struct {
11+
Title string `json:"title" jsonschema:"description=The title to submit"`
12+
Description *string `json:"description,omitempty" jsonschema:"description=The description to submit"`
13+
}
14+
type MyFunctionsArguments struct {
15+
Submitter string `json:"submitter" jsonschema:"description=The name of the thing calling this tool (openai, google, claude, etc)"`
16+
Content Content `json:"content" jsonschema:"description=The content of the message"`
17+
}
18+
19+
type ToggleLights struct {
20+
EntityID string `json:"entity_id,omitempty"`
21+
}
22+
23+
func main() {
24+
done := make(chan struct{})
25+
26+
s := server.NewServer(stdio.NewStdioServerTransport())
27+
err := s.RegisterTool("hello", "Say hello to a person", func(arguments MyFunctionsArguments) (*tools.ToolResponse, error) {
28+
return tools.NewToolReponse(tools.NewToolTextResponseContent(fmt.Sprintf("Hello, %s!", arguments.Submitter))), nil
29+
})
30+
if err != nil {
31+
panic(err)
32+
}
33+
34+
err = s.Serve()
35+
if err != nil {
36+
panic(err)
37+
}
38+
39+
<-done
40+
}

server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/invopop/jsonschema"
77
internaltools "github.com/metoro-io/mcp-golang/internal/tools"
88
protocol2 "github.com/metoro-io/mcp-golang/protocol"
9-
"github.com/metoro-io/mcp-golang/tools"
9+
"github.com/metoro-io/mcp-golang/server/tools"
1010
transport2 "github.com/metoro-io/mcp-golang/transport"
1111
"reflect"
1212
)
File renamed without changes.

0 commit comments

Comments
 (0)