Skip to content

Commit 7e29e87

Browse files
AdamShannagAdamShannag
authored andcommitted
fix: query param separator if other params already exists
Signed-off-by: Adam Shannag <[email protected]>
1 parent d686626 commit 7e29e87

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You can install the server in one of two ways:
1313
If you have Go installed, run:
1414

1515
```bash
16-
go install github.com/AdamShannag/api-mcp-server/cmd/[email protected].1
16+
go install github.com/AdamShannag/api-mcp-server/cmd/[email protected].2
1717
```
1818

1919
### 2. Download a pre-built binary

cmd/api-mcp-server/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ func main() {
2020
flag.StringVar(&transport, "t", "stdio", "Transport type (stdio or sse)")
2121
flag.StringVar(&transport, "transport", "stdio", "Transport type (stdio or sse)")
2222

23-
flag.StringVar(&toolsFilePath, "c", "./", "Tools config file path")
24-
flag.StringVar(&toolsFilePath, "config", "./", "Tools config file path")
23+
flag.StringVar(&toolsFilePath, "c", "./config.json", "Tools config file path")
24+
flag.StringVar(&toolsFilePath, "config", "./config.json", "Tools config file path")
2525
flag.Parse()
2626

2727
manager := tool.NewManager(request.NewExecutor(

examples/gitlab/gitlab.tools.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
11
[
2+
{
3+
"name": "TriggerPipeline",
4+
"description": "Triggers a pipeline using a GitLab trigger token for a specific project and branch.",
5+
"request": {
6+
"host": "{{env GITLAB_API_HOST:gitlab.com}}",
7+
"endpoint": "/api/v4/projects/:project_id/trigger/pipeline?token={{env GITLAB_TOKEN:not-set}}",
8+
"method": "POST",
9+
"secure": true,
10+
"queryParams": [
11+
"ref"
12+
],
13+
"pathParams": [
14+
"project_id"
15+
]
16+
},
17+
"args": [
18+
{
19+
"name": "project_id",
20+
"description": "The ID or URL-encoded path of the GitLab project (e.g. AdamShannag/test).",
21+
"required": true,
22+
"type": "string"
23+
},
24+
{
25+
"name": "ref",
26+
"description": "The name of the branch or tag to trigger the pipeline on.",
27+
"required": false,
28+
"default": "master",
29+
"type": "string"
30+
}
31+
]
32+
},
233
{
334
"name": "ListIssues",
435
"description": "Fetches all issues from a specified GitLab project using the GitLab API.",

pkg/request/executor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ func (e *executor) Execute(ctx context.Context, request types.Request, argValues
5151
}
5252
}
5353
if encoded := query.Encode(); encoded != "" {
54-
endpoint += "?" + encoded
54+
separator := "?"
55+
if strings.Contains(endpoint, "?") {
56+
separator = "&"
57+
}
58+
endpoint += separator + encoded
5559
}
5660

5761
scheme := "http"

0 commit comments

Comments
 (0)