Skip to content

Commit d1c3cfc

Browse files
committed
formatting
1 parent 6e75a2b commit d1c3cfc

File tree

2 files changed

+77
-77
lines changed

2 files changed

+77
-77
lines changed

mcp/prompts.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,42 @@ type ArgumentOption func(*PromptArgument)
1616
// The prompt will be configured based on the provided options.
1717
// Options are applied in order, allowing for flexible prompt configuration.
1818
func NewPrompt(name string, opts ...PromptOption) Prompt {
19-
prompt := Prompt{
20-
Name: name,
21-
}
19+
prompt := Prompt{
20+
Name: name,
21+
}
2222

23-
for _, opt := range opts {
24-
opt(&prompt)
25-
}
23+
for _, opt := range opts {
24+
opt(&prompt)
25+
}
2626

27-
return prompt
27+
return prompt
2828
}
2929

3030
// WithPromptDescription adds a description to the Prompt.
3131
// The description should provide a clear, human-readable explanation of what the prompt does.
3232
func WithPromptDescription(description string) PromptOption {
33-
return func(p *Prompt) {
34-
p.Description = description
35-
}
33+
return func(p *Prompt) {
34+
p.Description = description
35+
}
3636
}
3737

3838
// WithArgument adds an argument to the prompt's argument list.
3939
// The argument will be configured based on the provided options.
4040
func WithArgument(name string, opts ...ArgumentOption) PromptOption {
41-
return func(p *Prompt) {
42-
arg := PromptArgument{
43-
Name: name,
44-
}
45-
46-
for _, opt := range opts {
47-
opt(&arg)
48-
}
41+
return func(p *Prompt) {
42+
arg := PromptArgument{
43+
Name: name,
44+
}
4945

50-
if p.Arguments == nil {
51-
p.Arguments = make([]PromptArgument, 0)
52-
}
53-
p.Arguments = append(p.Arguments, arg)
54-
}
46+
for _, opt := range opts {
47+
opt(&arg)
48+
}
49+
50+
if p.Arguments == nil {
51+
p.Arguments = make([]PromptArgument, 0)
52+
}
53+
p.Arguments = append(p.Arguments, arg)
54+
}
5555
}
5656

5757
//
@@ -61,15 +61,15 @@ func WithArgument(name string, opts ...ArgumentOption) PromptOption {
6161
// ArgumentDescription adds a description to a prompt argument.
6262
// The description should explain the purpose and expected values of the argument.
6363
func ArgumentDescription(desc string) ArgumentOption {
64-
return func(arg *PromptArgument) {
65-
arg.Description = desc
66-
}
64+
return func(arg *PromptArgument) {
65+
arg.Description = desc
66+
}
6767
}
6868

6969
// RequiredArgument marks an argument as required in the prompt.
7070
// Required arguments must be provided when getting the prompt.
7171
func RequiredArgument() ArgumentOption {
72-
return func(arg *PromptArgument) {
73-
arg.Required = true
74-
}
72+
return func(arg *PromptArgument) {
73+
arg.Required = true
74+
}
7575
}

mcp/resources.go

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,47 @@ type ResourceOption func(*Resource)
88
// The resource will be configured based on the provided options.
99
// Options are applied in order, allowing for flexible resource configuration.
1010
func NewResource(uri string, name string, opts ...ResourceOption) Resource {
11-
resource := Resource{
12-
URI: uri,
13-
Name: name,
14-
}
11+
resource := Resource{
12+
URI: uri,
13+
Name: name,
14+
}
1515

16-
for _, opt := range opts {
17-
opt(&resource)
18-
}
16+
for _, opt := range opts {
17+
opt(&resource)
18+
}
1919

20-
return resource
20+
return resource
2121
}
2222

2323
// WithResourceDescription adds a description to the Resource.
2424
// The description should provide a clear, human-readable explanation of what the resource represents.
2525
func WithResourceDescription(description string) ResourceOption {
26-
return func(r *Resource) {
27-
r.Description = description
28-
}
26+
return func(r *Resource) {
27+
r.Description = description
28+
}
2929
}
3030

3131
// WithMIMEType sets the MIME type for the Resource.
3232
// This should indicate the format of the resource's contents.
3333
func WithMIMEType(mimeType string) ResourceOption {
34-
return func(r *Resource) {
35-
r.MIMEType = mimeType
36-
}
34+
return func(r *Resource) {
35+
r.MIMEType = mimeType
36+
}
3737
}
3838

3939
// WithAnnotations adds annotations to the Resource.
4040
// Annotations can provide additional metadata about the resource's intended use.
4141
func WithAnnotations(audience []Role, priority float64) ResourceOption {
42-
return func(r *Resource) {
43-
if r.Annotations == nil {
44-
r.Annotations = &struct {
45-
Audience []Role `json:"audience,omitempty"`
46-
Priority float64 `json:"priority,omitempty"`
47-
}{}
48-
}
49-
r.Annotations.Audience = audience
50-
r.Annotations.Priority = priority
51-
}
42+
return func(r *Resource) {
43+
if r.Annotations == nil {
44+
r.Annotations = &struct {
45+
Audience []Role `json:"audience,omitempty"`
46+
Priority float64 `json:"priority,omitempty"`
47+
}{}
48+
}
49+
r.Annotations.Audience = audience
50+
r.Annotations.Priority = priority
51+
}
5252
}
5353

5454
// ResourceTemplateOption is a function that configures a ResourceTemplate.
@@ -59,45 +59,45 @@ type ResourceTemplateOption func(*ResourceTemplate)
5959
// The template will be configured based on the provided options.
6060
// Options are applied in order, allowing for flexible template configuration.
6161
func NewResourceTemplate(uriTemplate string, name string, opts ...ResourceTemplateOption) ResourceTemplate {
62-
template := ResourceTemplate{
63-
URITemplate: uriTemplate,
64-
Name: name,
65-
}
62+
template := ResourceTemplate{
63+
URITemplate: uriTemplate,
64+
Name: name,
65+
}
6666

67-
for _, opt := range opts {
68-
opt(&template)
69-
}
67+
for _, opt := range opts {
68+
opt(&template)
69+
}
7070

71-
return template
71+
return template
7272
}
7373

7474
// WithTemplateDescription adds a description to the ResourceTemplate.
7575
// The description should provide a clear, human-readable explanation of what resources this template represents.
7676
func WithTemplateDescription(description string) ResourceTemplateOption {
77-
return func(t *ResourceTemplate) {
78-
t.Description = description
79-
}
77+
return func(t *ResourceTemplate) {
78+
t.Description = description
79+
}
8080
}
8181

8282
// WithTemplateMIMEType sets the MIME type for the ResourceTemplate.
8383
// This should only be set if all resources matching this template will have the same type.
8484
func WithTemplateMIMEType(mimeType string) ResourceTemplateOption {
85-
return func(t *ResourceTemplate) {
86-
t.MIMEType = mimeType
87-
}
85+
return func(t *ResourceTemplate) {
86+
t.MIMEType = mimeType
87+
}
8888
}
8989

9090
// WithTemplateAnnotations adds annotations to the ResourceTemplate.
9191
// Annotations can provide additional metadata about the template's intended use.
9292
func WithTemplateAnnotations(audience []Role, priority float64) ResourceTemplateOption {
93-
return func(t *ResourceTemplate) {
94-
if t.Annotations == nil {
95-
t.Annotations = &struct {
96-
Audience []Role `json:"audience,omitempty"`
97-
Priority float64 `json:"priority,omitempty"`
98-
}{}
99-
}
100-
t.Annotations.Audience = audience
101-
t.Annotations.Priority = priority
102-
}
93+
return func(t *ResourceTemplate) {
94+
if t.Annotations == nil {
95+
t.Annotations = &struct {
96+
Audience []Role `json:"audience,omitempty"`
97+
Priority float64 `json:"priority,omitempty"`
98+
}{}
99+
}
100+
t.Annotations.Audience = audience
101+
t.Annotations.Priority = priority
102+
}
103103
}

0 commit comments

Comments
 (0)