Skip to content

[ENHANCEMENT]: Add Tool for querying Global and Project scoped datasources - #96

Open
prakhar29jain wants to merge 3 commits into
perses:mainfrom
prakhar29jain:new-tool
Open

[ENHANCEMENT]: Add Tool for querying Global and Project scoped datasources#96
prakhar29jain wants to merge 3 commits into
perses:mainfrom
prakhar29jain:new-tool

Conversation

@prakhar29jain

Copy link
Copy Markdown
Contributor

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

@ibakshay

ibakshay commented Jul 9, 2026

Copy link
Copy Markdown
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
prakhar29jain marked this pull request as draft July 9, 2026 11:33
Signed-off-by: Prakhar Jain <prakhar29jain@gmail.com>
@prakhar29jain
prakhar29jain marked this pull request as ready for review July 14, 2026 07:22
@prakhar29jain

Copy link
Copy Markdown
Contributor Author

Please check the changes done in this PR and use the same syntax in this PR as well.

Done @ibakshay

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_datasource and perses_query_project_datasource tools 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.yaml to .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"},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Being able to query datasources

3 participants