Add jqschema middleware for tool call response transformation#295
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
we should have a story to selectively mount middlewares and configure them |
|
@copilot please fix these linting errors Running [/home/runner/golangci-lint-2.8.0-linux-amd64/golangci-lint run --timeout=5m] in [/home/runner/work/gh-aw-mcpg/gh-aw-mcpg] ...
Error: issues found |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
@copilot around line 290 in internal/server/unified.go make sure that the wrappedhandler wraps the finalhandler rather than just the handler Also, please fix these linting errors make lint |
- Changed wrappedHandler to call finalHandler instead of handler to properly apply middleware - Fixed gofmt formatting in health.go (removed trailing spaces) Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Fixed in 8dcfdcd:
All linting now passes with 0 issues. |
Implementation Complete: jqschema Tool Call Middleware ✅
Successfully implemented the jqschema shared agentic workflow from githubnext/gh-aw as a tool call middleware for the MCP Gateway.
Recent Updates
wrappedHandlernow callsfinalHandlerto properly apply middlewareImplementation Summary
Middleware Package (
internal/middleware/)jqschema.go- Core middleware implementationjqschema_test.go- Unit testsjqschema_integration_test.go- Integration testsREADME.md- Comprehensive documentation with future enhancement notesdemo.sh- Interactive demo scriptKey Features
github.com/itchyny/gojq(pure Go, no external processes)/tmp/gh-awmg/tools-calls/{randomID}/payload.jsonsys___*)Configuration
ShouldApplyMiddlewarefunction for basic filteringTesting & Quality
Response Transformation Example
Before (Original):
{ "total_count": 1000, "items": [{"login": "user1", "id": 123, "verified": true}] }After (Transformed):
{ "queryID": "a1b2c3d4e5f6789...", "payloadPath": "/tmp/gh-awmg/tools-calls/a1b2c3d4e5f6789.../payload.json", "preview": "{\"total_count\":1000,\"items\":[{\"login\":...", "schema": { "total_count": "number", "items": [{"login": "string", "id": "number", "verified": "boolean"}] }, "originalSize": 234, "truncated": false }Benefits
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.