[ENHANCEMENT]: Add Tool for querying Global and Project scoped datasources - #96
Open
prakhar29jain wants to merge 3 commits into
Open
[ENHANCEMENT]: Add Tool for querying Global and Project scoped datasources#96prakhar29jain wants to merge 3 commits into
prakhar29jain wants to merge 3 commits into
Conversation
Contributor
|
Please check the changes done in this PR and use the same syntax in this PR as well. |
…urces Signed-off-by: Prakhar Jain <prakhar29jain@gmail.com>
Signed-off-by: Prakhar Jain <prakhar29jain@gmail.com>
prakhar29jain
marked this pull request as draft
July 9, 2026 11:33
Signed-off-by: Prakhar Jain <prakhar29jain@gmail.com>
prakhar29jain
marked this pull request as ready for review
July 14, 2026 07:22
Contributor
Author
Done @ibakshay |
There was a problem hiding this comment.
Pull request overview
This PR adds new MCP tools that proxy HTTP queries through Perses to both global and project-scoped datasources, enabling datasource backend querying without exposing configured datasource credentials to the tool caller.
Changes:
- Add
perses_query_global_datasourceandperses_query_project_datasourcetools to forward GET/POST requests through the Perses proxy. - Introduce an internal proxy helper (
pkg/tools/internal/proxy) for building/executing constrained proxy requests and capping response size. - Update README datasource tooling documentation and add
perses-mcp-config.yamlto.gitignore.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new datasource query tools and expected behavior/inputs. |
| pkg/tools/internal/proxy/proxy.go | Adds shared request builder/executor for proxy calls, including response size cap and header filtering. |
| pkg/tools/globaldatasource/globaldatasource.go | Registers the global datasource query tool and wires it through the proxy helper. |
| pkg/tools/datasource/datasource.go | Registers the project datasource query tool and wires it through the proxy helper. |
| .gitignore | Ignores a local Perses MCP config file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+86
to
+90
| "method": { | ||
| Type: tools.SchemaTypeString, | ||
| Description: "HTTP method (default GET)", | ||
| Enum: []any{"http.MethodGet", "http.MethodPost"}, | ||
| }, |
Comment on lines
+89
to
+93
| "method": { | ||
| Type: tools.SchemaTypeString, | ||
| Description: "HTTP method (default GET)", | ||
| Enum: []any{"http.MethodGet", "http.MethodPost"}, | ||
| }, |
Comment on lines
+129
to
+132
| req, err := helper.BuildRequest(ctx, g.client.RESTClient().BaseURL.String(), sharedInput) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
Comment on lines
+132
to
+135
| req, err := helper.BuildRequest(ctx, d.client.RESTClient().BaseURL.String(), sharedInput) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } |
Comment on lines
+105
to
+106
| method := NormalizeMethod(input.Method) | ||
| path := NormalizePath(input.Path) |
| Type: tools.SchemaTypeObject, | ||
| Properties: map[string]*jsonschema.Schema{ | ||
| tools.ResourceName: { | ||
| "name": { |
| MinLength: new(1), | ||
| MaxLength: new(75), | ||
| Pattern: tools.PatternResourceName, | ||
| Pattern: "^[a-zA-Z0-9_.-]+$", |
| }, | ||
| }, | ||
| Required: []string{tools.ResourceName, "type", "url"}, | ||
| Required: []string{"name", "type", "url"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #66
What's Been Implemented
perses_query_global_datasource - Query a global datasource through Perses proxy.
perses_query_project_datasource - Query a project datasource through Perses proxy.
Updated README.md