From b266be16b3dfb957773e53126ee6d738eb53fc3d Mon Sep 17 00:00:00 2001 From: htjulia Date: Fri, 30 Oct 2026 14:26:57 +0900 Subject: [PATCH] fix(web): carry MCP tool error problems in _meta, as Protean does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Protean PR #91 moved a stable-code tool error's RFC 9457 problem from structuredContent to the result _meta under "org.htcom.protean/problem" (McpToolResult.PROBLEM_META_KEY). A declared outputSchema describes the success payload and the spec requires structuredContent to conform to it; clients that validate error results too, such as the TypeScript SDK 1.x, replaced the actual error with a schema-violation error. mcp_tool_problem now writes the problem under MCP_PROBLEM_META_KEY and no structuredContent. The [CODE] text, successful results, and JSON-RPC error.data are unchanged. A new test probes every tool that declares an outputSchema on its error path, as Java's conformance test does, and checks scope_list's STATE_CONFLICT over HTTP. docs(design): record the problem's place in tool error results Design 17 §4 and design 30 name the _meta key. Tags: #mcp #parity Co-Authored-By: htjulia --- crates/protrus-web/src/lib.rs | 137 ++++++++++++------ crates/protrus-web/src/mcp_features.rs | 2 +- .../17-mcp-session-and-extension-contract.md | 4 + docs/design/30-runtime-config-registry.md | 2 +- 4 files changed, 102 insertions(+), 43 deletions(-) diff --git a/crates/protrus-web/src/lib.rs b/crates/protrus-web/src/lib.rs index 31b7961..1df1d55 100644 --- a/crates/protrus-web/src/lib.rs +++ b/crates/protrus-web/src/lib.rs @@ -1540,8 +1540,14 @@ fn jackson_text(value: &Value) -> Option { } } +/// The result `_meta` key that carries a stable-code tool error's problem: Java's +/// `McpToolResult.PROBLEM_META_KEY`. +pub const MCP_PROBLEM_META_KEY: &str = "org.htcom.protean/problem"; + /// A stable-code tool error: Java's `McpToolResult.error(code, detail)`, whose RFC 9457 problem -/// becomes `structuredContent` and whose text carries the `[CODE]` prefix. +/// goes in `_meta` under [`MCP_PROBLEM_META_KEY`] and whose text carries the `[CODE]` prefix. It +/// carries no `structuredContent`: a declared `outputSchema` describes the success payload, and +/// clients that validate error results too would replace the error with a schema violation. fn mcp_tool_problem(code: &str, detail: &str, extensions: Value) -> Value { let (_, title) = mcp_error_code(code); let mut problem = json!({ @@ -1555,8 +1561,8 @@ fn mcp_tool_problem(code: &str, detail: &str, extensions: Value) -> Value { } json!({ "content": [{"type": "text", "text": format!("[{code}] {detail}")}], - "structuredContent": problem, - "isError": true + "isError": true, + "_meta": {MCP_PROBLEM_META_KEY: problem} }) } @@ -4432,8 +4438,8 @@ mod tests { .to_bytes(); let result: Value = serde_json::from_slice(&body).unwrap(); assert_eq!(result["result"]["isError"], true); - assert_eq!(result["result"]["structuredContent"]["code"], "PERMISSION_DENIED"); - assert_eq!(result["result"]["structuredContent"]["action"], "DELETE"); + assert_eq!(result["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "PERMISSION_DENIED"); + assert_eq!(result["result"]["_meta"][MCP_PROBLEM_META_KEY]["action"], "DELETE"); assert_eq!( *authorizer.0.lock().unwrap(), vec![ @@ -6095,11 +6101,11 @@ mod tests { for arguments in [json!({}), json!({"name": null}), json!({"name": " "})] { let (_, missing) = send(without(), mcp_call("protean.scope_get", arguments)).await; assert_eq!(missing["result"]["isError"], true); - assert_eq!(missing["result"]["structuredContent"]["code"], "INVALID_ARGUMENT"); + assert_eq!(missing["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "INVALID_ARGUMENT"); assert_eq!(missing["result"]["content"][0]["text"], "[INVALID_ARGUMENT] 'name' is required"); } let (_, off) = send(without(), mcp_call("protean.scope_list", json!({}))).await; - assert_eq!(off["result"]["structuredContent"]["code"], "STATE_CONFLICT"); + assert_eq!(off["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "STATE_CONFLICT"); assert_eq!( off["result"]["content"][0]["text"], "[STATE_CONFLICT] scope tools require worker.db.auto-provision=true — auto-provision is disabled, so there are no scopes to manage" @@ -6163,8 +6169,8 @@ mod tests { ] { // Authorization precedes the argument check, and an `id` is not a target module. let (_, denied) = send(app(), mcp_call(tool, json!({"id": "hello"}))).await; - assert_eq!(denied["result"]["structuredContent"]["code"], "PERMISSION_DENIED", "{tool}"); - assert_eq!(denied["result"]["structuredContent"]["action"], java_action, "{tool}"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "PERMISSION_DENIED", "{tool}"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["action"], java_action, "{tool}"); assert_eq!(authorizer.0.lock().unwrap().pop(), Some((None, action, None)), "{tool}"); } } @@ -6348,7 +6354,7 @@ mod tests { assert_eq!(tool("protean.get_shared_lib")["outputSchema"]["required"], json!(["name", "version", "sha256", "size"])); assert_eq!(tool("protean.list_shared_libs")["outputSchema"]["required"], json!(["generation", "libs"])); let (_, off) = send(without(), mcp_call("protean.list_shared_libs", json!({}))).await; - assert_eq!(off["result"]["structuredContent"]["code"], "STATE_CONFLICT"); + assert_eq!(off["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "STATE_CONFLICT"); let (_, list) = send(with(), mcp_call("protean.list_shared_libs", json!({}))).await; assert_eq!(list["result"]["content"][0]["text"], "Shared libs: 1 (generation 1)"); @@ -6360,9 +6366,10 @@ mod tests { assert_eq!( absent["result"], json!({"content": [{"type": "text", "text": "[SHARED_LIB_NOT_FOUND] shared lib not found: nope"}], - "structuredContent": {"type": "urn:protean:error:shared-lib-not-found", "title": "Shared lib not found", - "detail": "shared lib not found: nope", "code": "SHARED_LIB_NOT_FOUND", "name": "nope"}, - "isError": true}) + "isError": true, + "_meta": {MCP_PROBLEM_META_KEY: {"type": "urn:protean:error:shared-lib-not-found", + "title": "Shared lib not found", "detail": "shared lib not found: nope", + "code": "SHARED_LIB_NOT_FOUND", "name": "nope"}}}) ); // `ToolArgs.require` and the Base64 check are protocol errors. for (tool, arguments, message) in [ @@ -6391,8 +6398,8 @@ mod tests { mcp_call("protean.deploy_shared_lib", json!({"name": "conflict", "version": "1", "bytesBase64": "AA=="})), ) .await; - assert_eq!(conflict["result"]["structuredContent"]["code"], "STATE_CONFLICT"); - assert_eq!(conflict["result"]["structuredContent"]["version"], "1"); + assert_eq!(conflict["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "STATE_CONFLICT"); + assert_eq!(conflict["result"]["_meta"][MCP_PROBLEM_META_KEY]["version"], "1"); let (_, failed) = send( with(), mcp_call("protean.deploy_shared_lib", json!({"name": "boom", "version": "1", "bytesBase64": "AA=="})), @@ -6406,7 +6413,7 @@ mod tests { assert_eq!(removed["result"]["content"][0]["text"], "Shared lib acme removed → generation 3"); assert_eq!(removed["result"]["structuredContent"]["libs"].as_array().unwrap().len(), 1); let (_, again) = send(with(), mcp_call("protean.remove_shared_lib", json!({"name": "acme"}))).await; - assert_eq!(again["result"]["structuredContent"]["code"], "SHARED_LIB_NOT_FOUND"); + assert_eq!(again["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "SHARED_LIB_NOT_FOUND"); } #[tokio::test] async fn shared_lib_tools_authorize_with_java_action_names() { @@ -6421,8 +6428,8 @@ mod tests { // Authorization precedes the argument check; the tools keep `McpTool`'s default // target, the `id` argument. let (_, denied) = send(app(), mcp_call(tool, json!({"id": "hello"}))).await; - assert_eq!(denied["result"]["structuredContent"]["code"], "PERMISSION_DENIED", "{tool}"); - assert_eq!(denied["result"]["structuredContent"]["action"], java_action, "{tool}"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "PERMISSION_DENIED", "{tool}"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["action"], java_action, "{tool}"); assert_eq!( authorizer.0.lock().unwrap().pop(), Some((None, action, Some("hello".into()))), @@ -6614,17 +6621,17 @@ mod tests { let (_, failed) = send(app(), mcp_call("consumer.echo", json!({"text": "boom"}))).await; assert_eq!(failed["result"], json!({"content": [{"type": "text", "text": "echo failed"}], "isError": true})); let (_, refused) = send(app(), mcp_call("consumer.echo", json!({"text": "gate"}))).await; - assert_eq!(refused["result"]["structuredContent"]["code"], "STATE_CONFLICT"); - assert_eq!(refused["result"]["structuredContent"]["text"], "gate"); + assert_eq!(refused["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "STATE_CONFLICT"); + assert_eq!(refused["result"]["_meta"][MCP_PROBLEM_META_KEY]["text"], "gate"); let (_, invalid) = send(app(), mcp_call("consumer.echo", json!({"text": "bad"}))).await; assert_eq!(invalid["error"]["message"], "[INVALID_ARGUMENT] echo: text is invalid"); // A consumer tool is authorized as CUSTOM against the `id` argument, as Java's defaults. let denied_app = router_with_mcp_session_store(Arc::new(Source), store.clone(), authorizer.clone()); let (_, denied) = send(denied_app, mcp_call("consumer.echo", json!({"id": "hello"}))).await; - assert_eq!(denied["result"]["structuredContent"]["code"], "PERMISSION_DENIED"); - assert_eq!(denied["result"]["structuredContent"]["action"], "CUSTOM"); - assert_eq!(denied["result"]["structuredContent"]["tool"], "consumer.echo"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "PERMISSION_DENIED"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["action"], "CUSTOM"); + assert_eq!(denied["result"]["_meta"][MCP_PROBLEM_META_KEY]["tool"], "consumer.echo"); assert_eq!(authorizer.0.lock().unwrap().pop(), Some((None, ControlAction::Custom, Some("hello".into())))); // A registered name replaces a built-in tool in place, as Java's name-keyed map does. @@ -6817,7 +6824,7 @@ mod tests { // Strict input validation runs before authorization and the tool, as Java's. let (_, wrong) = send(app(), mcp_call("protean.get_module", json!({"id": 5}))).await; - assert_eq!(wrong["result"]["structuredContent"]["code"], "INVALID_ARGUMENT"); + assert_eq!(wrong["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "INVALID_ARGUMENT"); let text = wrong["result"]["content"][0]["text"].as_str().unwrap(); assert!(text.starts_with("[INVALID_ARGUMENT] arguments violate inputSchema: "), "{text}"); @@ -6847,8 +6854,8 @@ mod tests { } store.register_tool(Arc::new(Shaped)).await; let (_, nested) = send(app(), mcp_call("consumer.shaped", json!({}))).await; - assert_eq!(nested["result"]["structuredContent"]["code"], "OUTPUT_SCHEMA_VIOLATION"); - assert_eq!(nested["result"]["structuredContent"]["title"], "Output schema violation"); + assert_eq!(nested["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "OUTPUT_SCHEMA_VIOLATION"); + assert_eq!(nested["result"]["_meta"][MCP_PROBLEM_META_KEY]["title"], "Output schema violation"); store.set_strict_schema(false); let (_, slipped) = send(app(), mcp_call("consumer.shaped", json!({}))).await; assert_eq!(slipped["result"]["content"][0]["text"], "n is text"); @@ -6863,7 +6870,7 @@ mod tests { "[OUTPUT_SCHEMA_VIOLATION] output schema violation: structuredContent missing or not an object (outputSchema declared)" ); let (_, loose) = send(app(), mcp_call("protean.get_module", json!({"id": 5}))).await; - assert_ne!(loose["result"]["structuredContent"]["code"], "INVALID_ARGUMENT", "strict off skips input validation"); + assert_ne!(loose["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "INVALID_ARGUMENT", "strict off skips input validation"); } #[tokio::test] async fn resource_update_bridge_notifies_the_module_list_and_its_versions() { @@ -6956,8 +6963,8 @@ mod tests { assert_eq!(found["result"]["content"][0]["text"], "Module hello"); let (_, missing) = call("protean.get_module", json!({"id": "ghost"})).await; assert_eq!(missing["result"]["isError"], true); - assert_eq!(missing["result"]["structuredContent"]["code"], "MODULE_NOT_FOUND"); - assert_eq!(missing["result"]["structuredContent"]["moduleId"], "ghost"); + assert_eq!(missing["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "MODULE_NOT_FOUND"); + assert_eq!(missing["result"]["_meta"][MCP_PROBLEM_META_KEY]["moduleId"], "ghost"); assert_eq!(missing["result"]["content"][0]["text"], "[MODULE_NOT_FOUND] module not found: ghost"); // Absent, null, and blank are one case, reported as a protocol error. for arguments in [json!({}), json!({"id": null}), json!({"id": " "})] { @@ -6978,7 +6985,7 @@ mod tests { assert_eq!(rolled["result"]["content"][0]["text"], "Module hello rolled back → v1"); } let (_, label) = call("protean.rollback_module", json!({"id": "hello", "version": "1.0.0"})).await; - assert_eq!(label["result"]["structuredContent"]["code"], "INVALID_ARGUMENT"); + assert_eq!(label["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "INVALID_ARGUMENT"); let (_, approved) = call("protean.approve_module", json!({"id": "hello", "approver": "reviewer"})).await; @@ -6991,7 +6998,7 @@ mod tests { assert!(rejected["result"].get("structuredContent").is_none()); let (_, gone) = call("protean.uninstall_module", json!({"id": "ghost"})).await; - assert_eq!(gone["result"]["structuredContent"]["code"], "MODULE_NOT_FOUND"); + assert_eq!(gone["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "MODULE_NOT_FOUND"); let (_, uninstalled) = call("protean.uninstall_module", json!({"id": "hello"})).await; assert_eq!(uninstalled["result"]["content"][0]["text"], "Module hello uninstalled"); // The pre-Java argument name is not kept as an alias. @@ -7011,7 +7018,7 @@ mod tests { let (_, updated) = call("protean.update_module", envelope("hello")).await; assert_eq!(updated["result"]["content"][0]["text"], "Module hello updated (v1)"); let (_, absent) = call("protean.update_module", envelope("ghost")).await; - assert_eq!(absent["result"]["structuredContent"]["code"], "MODULE_NOT_FOUND"); + assert_eq!(absent["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "MODULE_NOT_FOUND"); let (_, deployed) = call("protean.deploy_module", envelope("ghost")).await; assert_eq!(deployed["result"]["content"][0]["text"], "Module ghost deployed (ACTIVE)"); let (_, malformed) = call("protean.deploy_module", json!({"record": {}})).await; @@ -7143,7 +7150,7 @@ mod tests { assert_eq!(ids(&page(json!({"trustTier": " trusted "}))).len(), 5); let rejected = page(json!({"trustTier": "SOMETIMES"})); assert_eq!(rejected["isError"], true); - assert_eq!(rejected["structuredContent"]["code"], "INVALID_ARGUMENT"); + assert_eq!(rejected["_meta"][MCP_PROBLEM_META_KEY]["code"], "INVALID_ARGUMENT"); assert_eq!( rejected["content"][0]["text"], "[INVALID_ARGUMENT] trustTier must be one of TRUSTED, UNTRUSTED (got: SOMETIMES)" @@ -7167,7 +7174,7 @@ mod tests { ] { let app = router_with_mcp_and_authorizer(Arc::new(Source), true, authorizer.clone()); let (_, denied) = send(app, mcp_call(tool, json!({}))).await; - let problem = &denied["result"]["structuredContent"]; + let problem = &denied["result"]["_meta"][MCP_PROBLEM_META_KEY]; assert_eq!(problem["code"], "PERMISSION_DENIED", "{tool}"); assert_eq!(problem["action"], java_action, "{tool}"); assert_eq!(problem["tool"], tool); @@ -7201,7 +7208,55 @@ mod tests { } let app = router_with_mcp_and_authorizer(Arc::new(Source), true, Arc::new(Silent)); let (_, silent) = send(app, mcp_call("protean.list_modules", json!({}))).await; - assert_eq!(silent["result"]["structuredContent"]["detail"], "authorizer denied"); + assert_eq!(silent["result"]["_meta"][MCP_PROBLEM_META_KEY]["detail"], "authorizer denied"); + } + /// Java's `McpOutputSchemaConformanceTest.error_results_never_carry_a_nonconforming_structured_content` + /// and `McpHttpControllerTest.coded_tool_error_over_http_carries_its_problem_in_meta`. + #[tokio::test] + async fn coded_tool_errors_carry_their_problem_in_meta() { + let app = || router_with_mcp(Arc::new(Source), true); + let (_, listed) = send(app(), rpc("tools/list", json!({}))).await; + let probes = [ + json!({}), + json!({"id": "no-such-module"}), + json!({"name": "no-such-name", "key": "no.such.key"}), + ]; + let mut exercised = Vec::new(); + for tool in listed["result"]["tools"].as_array().unwrap() { + let (Some(name), Some(schema)) = (tool["name"].as_str(), tool.get("outputSchema")) else { + continue; + }; + for arguments in &probes { + let (_, response) = send(app(), mcp_call(name, arguments.clone())).await; + let result = &response["result"]; + if result["isError"] != true { + continue; + } + if let Some(structured) = result.get("structuredContent") { + let violations = mcp_features::schema_violations(schema, structured); + assert!(violations.is_empty(), "{name} (error result): {violations:?}"); + } + let problem = &result["_meta"][MCP_PROBLEM_META_KEY]; + assert!( + problem.is_object() && problem["code"].as_str().is_some_and(|code| !code.is_empty()), + "{name} coded error carries its problem in _meta: {result}" + ); + exercised.push(name.to_owned()); + break; + } + } + for name in ["protean.scope_list", "protean.get_module", "protean.module_versions"] { + assert!(exercised.iter().any(|tool| tool == name), "error paths exercised: {exercised:?}"); + } + assert!(exercised.len() >= 10, "error paths exercised: {exercised:?}"); + + // Over HTTP: scope_list without auto-provision. + let (status, response) = send(app(), mcp_call("protean.scope_list", json!({}))).await; + assert_eq!(status, StatusCode::OK); + assert_eq!(response["result"]["isError"], true); + assert!(response["result"].get("structuredContent").is_none()); + assert_eq!(response["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "STATE_CONFLICT"); + assert!(response["result"]["content"][0]["text"].as_str().unwrap().starts_with("[STATE_CONFLICT] ")); } /// A patch envelope for the `hello` fixture: `delta` over the base artifact, signed as such. fn patch_envelope(delta: BTreeMap>) -> Value { @@ -7275,8 +7330,8 @@ mod tests { let mut ghost = patch_envelope(resource()); ghost["id"] = json!("ghost"); let (_, absent) = call("protean.patch_module", ghost).await; - assert_eq!(absent["result"]["structuredContent"]["code"], "MODULE_NOT_FOUND"); - assert_eq!(absent["result"]["structuredContent"]["moduleId"], "ghost"); + assert_eq!(absent["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "MODULE_NOT_FOUND"); + assert_eq!(absent["result"]["_meta"][MCP_PROBLEM_META_KEY]["moduleId"], "ghost"); let (_, blank) = call("protean.reload_module_resources", json!({"id": " "})).await; assert_eq!( blank["error"]["message"], @@ -7510,7 +7565,7 @@ mod tests { let (_, response) = send(app.clone(), mcp_call("config.get", json!({"key": "no.such.key"}))).await; assert_eq!(response["result"]["isError"], true); - assert_eq!(response["result"]["structuredContent"]["code"], "INVALID_ARGUMENT"); + assert_eq!(response["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "INVALID_ARGUMENT"); assert_eq!( response["result"]["content"][0]["text"], "[INVALID_ARGUMENT] unknown config key: no.such.key" @@ -7537,7 +7592,7 @@ mod tests { .await; assert_eq!(response["result"]["isError"], true); // Outcomes keep the request order, as Java's LinkedHashMap does. - let outcomes = &response["result"]["structuredContent"]["outcomes"]; + let outcomes = &response["result"]["_meta"][MCP_PROBLEM_META_KEY]["outcomes"]; assert_eq!(outcomes[0]["key"], "gate.approval.required"); assert_eq!(outcomes[0]["outcome"], "NOT_APPLIED_BATCH_ABORTED"); assert_eq!(outcomes[1]["outcome"], "REJECTED_UNKNOWN"); @@ -7581,8 +7636,8 @@ mod tests { ) .await; assert_eq!(response["result"]["isError"], true); - assert_eq!(response["result"]["structuredContent"]["code"], "PERMISSION_DENIED"); - assert_eq!(response["result"]["structuredContent"]["tool"], "config.set"); + assert_eq!(response["result"]["_meta"][MCP_PROBLEM_META_KEY]["code"], "PERMISSION_DENIED"); + assert_eq!(response["result"]["_meta"][MCP_PROBLEM_META_KEY]["tool"], "config.set"); assert_eq!(authorizer.0.lock().unwrap()[0].1, ControlAction::Configure); assert!(audit.lock().unwrap().is_empty()); diff --git a/crates/protrus-web/src/mcp_features.rs b/crates/protrus-web/src/mcp_features.rs index b2237b2..d8de224 100644 --- a/crates/protrus-web/src/mcp_features.rs +++ b/crates/protrus-web/src/mcp_features.rs @@ -646,7 +646,7 @@ impl McpSessionStore { /// Every message of validating `instance` against `schema` (draft 2020-12, as Java's networknt /// validator), or the reason the schema itself does not compile. -fn schema_violations(schema: &Value, instance: &Value) -> Vec { +pub(super) fn schema_violations(schema: &Value, instance: &Value) -> Vec { match jsonschema::draft202012::new(schema) { Ok(validator) => validator .iter_errors(instance) diff --git a/docs/design/17-mcp-session-and-extension-contract.md b/docs/design/17-mcp-session-and-extension-contract.md index 0822572..5fe1cd7 100644 --- a/docs/design/17-mcp-session-and-extension-contract.md +++ b/docs/design/17-mcp-session-and-extension-contract.md @@ -114,6 +114,10 @@ Protean `mcp/tools`의 module 도구를 같은 이름·인자 이름으로 이 경우) JSON-RPC `-32602` `[INVALID_ARGUMENT] : is required`와 `error.data` problem을 낸다. 권한 거부는 tool result `PERMISSION_DENIED` problem(`action`, `tool` 확장), 대상이 없으면 `MODULE_NOT_FOUND` problem(`moduleId` 확장)이다. 그 밖의 도메인 실패는 code 없는 `isError` text다. +code가 붙은 tool 오류는 `[CODE] detail` text와 함께 RFC 9457 problem을 result `_meta["org.htcom.protean/problem"]` +(`MCP_PROBLEM_META_KEY`, Java `McpToolResult.PROBLEM_META_KEY`)에 싣고 `structuredContent`는 싣지 않는다(Java PR #91). +선언된 `outputSchema`는 성공 payload를 기술하고, 오류 result까지 검증하는 client는 실제 오류 대신 schema 위반을 +보고하기 때문이다. 성공 result와 JSON-RPC `error.data`는 그대로다. get·versions·update·patch·reload·uninstall은 Java처럼 실행 전에 존재를 확인하고, approve·reject·rollback은 domain 실패로 돌려준다. module id 형식이 틀리면 Java에서 조회가 비는 것과 같게 `MODULE_NOT_FOUND`로 답한다. diff --git a/docs/design/30-runtime-config-registry.md b/docs/design/30-runtime-config-registry.md index 949c418..ff44382 100644 --- a/docs/design/30-runtime-config-registry.md +++ b/docs/design/30-runtime-config-registry.md @@ -145,7 +145,7 @@ 1. **등록부와 REST.** `protrus-config` crate(64 key, 원자 apply, masking)와 `GET/PATCH /platform/config`. 2. **host 연결과 MCP.** - MCP `config.list`·`config.get`·`config.set`: 이름, schema, 요약 문구, 오류 결과(`[CODE]` 접두 text와 RFC 9457 - problem `structuredContent`, abort 시 `outcomes` 확장)가 Java와 같다. set은 `ControlAction::Configure`로 + problem을 result `_meta["org.htcom.protean/problem"]`에, abort 시 `outcomes` 확장)가 Java와 같다. set은 `ControlAction::Configure`로 인가하고, 거부되면 `PERMISSION_DENIED`(`action: CUSTOM`, `tool`)다. Java처럼 MCP가 켜져 있을 때만 보인다. - 세 `execution_mode` 모두 `/platform/config`를 마운트하고 부트스트랩 `config` map으로 레지스트리를 초기화한다. - bound key: `gate.approval.required`(세 토폴로지), `worker.container.auto-restart`(OCI),