Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
246 changes: 240 additions & 6 deletions enterprise/e2e/html/hurl/mcp-2025-11-25-list_directory.all.hurl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ body startsWith "{\n \"openapi\": \"3.2.0\",\n \"$self\": \"{{base}}/test/open
"$self": "{{base}}/test/openapi-split-entry",
"info": {
"title": "Split",
"version": "1.0.0"
"version": "1.0.0",
"summary": "What a listing says of this API",
"description": "The long form, which a summary beside it stands in for"
},
"paths": {
"/pets": {
Expand Down Expand Up @@ -155,7 +157,9 @@ body startsWith "{\n \"openapi\": \"3.2.0\",\n \"$self\": \"{{base}}/test/open
"$self": "{{base}}/test/openapi-split-entry",
"info": {
"title": "Split",
"version": "1.0.0"
"version": "1.0.0",
"summary": "What a listing says of this API",
"description": "The long form, which a summary beside it stands in for"
},
"paths": {
"/pets": {
Expand Down Expand Up @@ -313,7 +317,8 @@ body startsWith "{\n \"openapi\": \"3.0.4\",\n \"info\": {\n"
"openapi": "3.0.4",
"info": {
"title": "Petstore",
"version": "1.0.0"
"version": "1.0.0",
"description": "Everything about the pets this shop keeps"
},
"paths": {
"/pets": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ jsonpath "$.id" == 800
jsonpath "$.result.isError" == false
jsonpath "$.result.content" count == 1
jsonpath "$.result.content[0].type" == "text"
jsonpath "$.result.structuredContent.bytes" == 818
variable "text" jsonpath "$.bytes" == 818
jsonpath "$.result.structuredContent.bytesBundled" == 1741
variable "text" jsonpath "$.bytesBundled" == 1741
jsonpath "$.result.structuredContent.bytes" == 945
variable "text" jsonpath "$.bytes" == 945
jsonpath "$.result.structuredContent.bytesBundled" == 1868
variable "text" jsonpath "$.bytesBundled" == 1868
jsonpath "$.result.structuredContent.identifier" == "{{base}}/test/openapi-split-entry"
variable "text" jsonpath "$.identifier" == "{{base}}/test/openapi-split-entry"
jsonpath "$.result.structuredContent.path" == "/test/openapi-split-entry"
Expand All @@ -121,6 +121,8 @@ jsonpath "$.result.structuredContent.baseDialect" == "https://json-schema.org/dr
variable "text" jsonpath "$.baseDialect" == "https://json-schema.org/draft/2020-12/schema"
jsonpath "$.result.structuredContent.title" == "Split"
variable "text" jsonpath "$.title" == "Split"
jsonpath "$.result.structuredContent.description" == "What a listing says of this API"
variable "text" jsonpath "$.description" == "What a listing says of this API"
jsonpath "$.result.structuredContent.health" == 100
variable "text" jsonpath "$.health" == 100
jsonpath "$.result.structuredContent.operations" == 0
Expand Down
246 changes: 240 additions & 6 deletions enterprise/e2e/html/hurl/mcp-2026-07-28-list_directory.all.hurl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ body startsWith "{\n \"openapi\": \"3.2.0\",\n \"$self\": \"{{base}}/test/open
"$self": "{{base}}/test/openapi-split-entry",
"info": {
"title": "Split",
"version": "1.0.0"
"version": "1.0.0",
"summary": "What a listing says of this API",
"description": "The long form, which a summary beside it stands in for"
},
"paths": {
"/pets": {
Expand Down Expand Up @@ -166,7 +168,9 @@ body startsWith "{\n \"openapi\": \"3.2.0\",\n \"$self\": \"{{base}}/test/open
"$self": "{{base}}/test/openapi-split-entry",
"info": {
"title": "Split",
"version": "1.0.0"
"version": "1.0.0",
"summary": "What a listing says of this API",
"description": "The long form, which a summary beside it stands in for"
},
"paths": {
"/pets": {
Expand Down Expand Up @@ -335,7 +339,8 @@ body startsWith "{\n \"openapi\": \"3.0.4\",\n \"info\": {\n"
"openapi": "3.0.4",
"info": {
"title": "Petstore",
"version": "1.0.0"
"version": "1.0.0",
"description": "Everything about the pets this shop keeps"
},
"paths": {
"/pets": {
Expand Down
1 change: 1 addition & 0 deletions enterprise/e2e/html/schemas/test/openapi-petstore.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"openapi": "3.0.4",
"info": {
"title": "Petstore",
"description": "Everything about the pets this shop keeps",
"version": "1.0.0"
},
"paths": {
Expand Down
2 changes: 2 additions & 0 deletions enterprise/e2e/html/schemas/test/openapi-split-entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"openapi": "3.2.0",
"info": {
"title": "Split",
"summary": "What a listing says of this API",
"description": "The long form, which a summary beside it stands in for",
"version": "1.0.0"
},
"paths": {
Expand Down
15 changes: 13 additions & 2 deletions src/actions/action_list_directory_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ class ActionListDirectoryV1 : public sourcemeta::one::RouterAction {

if (const auto *entries{result.try_at("entries")};
entries != nullptr && entries->is_array()) {
// Either kind is a resource a caller can read, addressed the same way
// and differing only in the media type the link announces
for (const auto &entry : entries->as_array()) {
if (entry.at_or("type", EMPTY_STRING).to_string() != "schema") {
const auto &kind{entry.at_or("type", EMPTY_STRING).to_string()};
const auto describes_api{kind == OPENAPI_RESOURCE_KIND};
if (kind != SCHEMA_RESOURCE_KIND && !describes_api) {
continue;
}
if (!entry.defines("identifier")) {
Expand All @@ -133,7 +137,8 @@ class ActionListDirectoryV1 : public sourcemeta::one::RouterAction {
content.push_back(sourcemeta::one::mcp_resource_block(
version, entry.at("identifier").to_string(),
title.empty() ? entry.at("path").to_string() : title,
entry.at_or("description", EMPTY_STRING).to_string()));
entry.at_or("description", EMPTY_STRING).to_string(),
describes_api ? OPENAPI_MIME_TYPE : SCHEMA_MIME_TYPE));
}
}

Expand All @@ -142,6 +147,12 @@ class ActionListDirectoryV1 : public sourcemeta::one::RouterAction {
}

private:
static constexpr std::string_view SCHEMA_RESOURCE_KIND{"schema"};
static constexpr std::string_view OPENAPI_RESOURCE_KIND{"openapi"};
static constexpr std::string_view SCHEMA_MIME_TYPE{"application/schema+json"};
static constexpr std::string_view OPENAPI_MIME_TYPE{
"application/openapi+json"};

std::string_view response_schema_;
std::string_view rpc_request_schema_;
std::string_view rpc_response_schema_;
Expand Down
Loading