Repository navigation
Serve API Explorer APIs and operations from the docs API - #4887
Merged
Merged
Conversation
The CLI and other HTTP clients can now search, read and list API Explorer operations without speaking MCP. The gateway moves to the search project, and a shared ApiReferenceService holds the argument checks and grouping, so the MCP tools and the new /api-reference endpoints answer the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The operation lookup told HTTP callers to pass operationId, which the endpoint does not take. The REST API page now lists the three lookups with their parameters, defaults, responses and status codes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
akira28
force-pushed
the
feature/api-operations-rest-endpoints
branch
from
November 17, 2026 12:20
168d742 to
cbe5c12
Compare
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4887/ Sample changed pages: |
The lookups move from /api-reference/{,search,operation} to
/api-operations: the collection filters by q or by endpoint, one
operation reads by id, and groups and apis are their own routes, so each
route returns one shape. An endpoint lookup now lists every operation that
serves the request, best first, instead of reading the top match.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Operations are one collection at /api-operations, filtered by q, endpoint,
operation_id, api, version and group, and read at /api-operations/{id},
where id is {api}:{operationId}. APIs and their groups move to /apis, so no
literal route shadows an id. view=full adds fields to each result, so an
endpoint or id lookup without an API key takes one request.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The gateway's lookups already load each match's trees, properties and body, so FindOperationsAsync returns them all and the full view no longer reads each other match again. Group counts drop deprecated operations unless include_deprecated is set, like the group listing, and a blank API key is a 400 instead of a NullReferenceException. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every other rule of the operations collection lives in ApiReferenceService.QueryAsync; the view check was the only one in the HTTP handler, so it now sits with them and has a unit test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Most operation ids and many routes exist in several APIs: elasticsearch and
elasticsearch-serverless share 325 ids, kibana and kibana-serverless 724. A
lookup across APIs had to pick one, in no defined order. Operations now live
under /apis/{api}/operations, searched, looked up by endpoint or listed there,
and read at /apis/{api}/operations/{operationId}. /api-operations, the
{api}:{operationId} ids and the operation_id filter are gone. The MCP tools
keep their optional api.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
akira28
added a commit
that referenced
this pull request
Nov 17, 2026
The copy follows #4887, where /api-operations moved to /apis/{api}/operations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
reakaleek
approved these changes
Nov 18, 2026
akira28
added a commit
that referenced
this pull request
Nov 18, 2026
The copy follows #4887, where /api-operations moved to /apis/{api}/operations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
The docs API gains an
/docs/_api/v1/apisresource, with each API's operations under it, that answers the same lookups as the API MCP tools in #4886. HTTP clients such as the Elastic CLI can now search, read and list API Explorer operations without speaking MCP.Affects: API, MCP
Follows: #4886, now merged. This PR is rebased onto
main.Stack: bottom of #4895. #4894, #4896, #4897 and #4898 build on it.
Prompt summary: The Elastic CLI should expose the API Explorer MCP tools as
elastic docs api *commands (elastic/docs-eng-team#1204) and call the docs API rather than the MCP server. Add the matching API requests here, reusing the MCP code where possible.Why
The CLI reaches the docs site only through
/docs/_api/v1(search,ask-ai). The new API lookups exist only as MCP tools. A CLI that called them would need to speak JSON-RPC over Streamable HTTP, which is the wrong layer for a plain HTTP client.What
One service for both surfaces
ApiGateway,IApiGatewayandApiRouteMatchmove unchanged fromMcp.Remote/GatewaysintoElastic.Documentation.Search/ApiReference, which both apps already reference.A new
ApiReferenceServiceholds whatApiToolsdid before:version needs apicheckIt answers with an
ApiReferenceReplyunion: one of its response records, or anApiReferenceRejection. The response records move fromMcpResponsesto sit next to the service.ApiToolskeeps its tool names, parameters and descriptions, and now maps that union ontoToolReply. ThebodyNotestays MCP-only, because it tells the caller to passincludeBody=true.ResponseBody.Notenow takes a body length, so the MCP layer can still compute the note.AddApiReferenceServices()registers the gateway and the service for both apps.The gateway gains
FindOperationsAsync. Its id and endpoint lookups already load every ranked match withDetailSource, so it returns all of them with their versions, fields and body from that one query.GetOperationAsyncis built on it.Endpoints
Every operation lives under its API. Most operation ids and many routes exist in several APIs:
elasticsearchandelasticsearch-serverlessshare 325 ids,kibanaandkibana-serverless724, andcloudandcloud-enterprise115. A lookup across APIs could only return them in an undefined order and pick one, so the REST API has none.GET /apislist_api_operationswithout argumentsGET /apis/{api}GET /apis/{api}/groups?version=&include_deprecated=list_api_operationsGET /apis/{api}/operations?q=&version=&include_deprecated=&page=&size=search_api_operationswith an APIGET /apis/{api}/operations?endpoint=&view=full&include_body=get_api_operationby endpoint, with every match in the API, best route firstGET /apis/{api}/operations?group=&page=&size=list_api_operationswith a group, pagedGET /apis/{api}/operations/{operationId}?version=&include_body=get_api_operationby id{api}is part of every operation path, so an operation id or a route matches in that API only. Results are complete and deterministic, and no client has to pick one.qorendpoint. Without either, it lists the API by path, hides deprecated operations unlessinclude_deprecated=true, and pages. That makes the group-names-only reply for large APIs unnecessary; it moves to/apis/{api}/groups./{index}, can serve several operations even within one API, so an endpoint lookup returns a page.view=fulladds each match'sversionsandfields, andinclude_body=trueits body. That's one request and one index query, becauseFindOperationsAsyncreturns the details./apis/{api}/groupsdrops deprecated operations unlessinclude_deprecated=true, like the listing, so a group's count equals its listing'stotalHits. A blank API key is a 400.ApiReferenceService, includingview, with unit tests inApiReferenceServiceTests.{ "errorType", "message" }, with 404 for*_not_foundand 400 otherwise. Publish an OpenAPI document for the docs API and answer errors as RFC 9457 problems #4896 replaces this body with RFC 9457 problems.navigation-search.apistays optional, so agents can still search across APIs, and a lookup without it may match in several.One wording change: the
group_not_foundmessage no longer names the MCP tool.Verify
I ran the two unit projects locally on top of
main(267 and 76 tests pass) and built the integration project. I did not run the endpoints against a real index.🤖 Generated with Claude Code