feat: expose _meta in tool metadata and map parametersSchema to inputSchema
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 27s

This commit is contained in:
jade
2026-08-13 18:04:57 +09:00
parent 93257b1bc6
commit ad4758d0ba
5 changed files with 42 additions and 10 deletions

View File

@@ -215,9 +215,10 @@
const badgeBorder = isDirect ? 'rgba(59,130,246,0.3)' : 'rgba(249,115,22,0.3)';
let paramHtml = '';
if (tool.parametersSchema && tool.parametersSchema.properties) {
const props = tool.parametersSchema.properties;
const required = tool.parametersSchema.required || [];
const schema = tool.inputSchema || tool.parametersSchema;
if (schema && schema.properties) {
const props = schema.properties;
const required = schema.required || [];
if (Object.keys(props).length > 0) {
paramHtml = `
<div style="margin-top:16px; padding-top:16px; border-top:1px solid #27272a;">

View File

@@ -217,7 +217,7 @@
const option = document.createElement('option');
option.value = tool.name;
option.textContent = tool.name;
option.dataset.schema = JSON.stringify(tool.parametersSchema);
option.dataset.schema = JSON.stringify(tool.inputSchema || tool.parametersSchema);
option.dataset.prompts = JSON.stringify(tool.actionPrompts || {});
option.dataset.integrationType = tool.integrationType || 'HTTP';
optgroup.appendChild(option);

View File

@@ -351,12 +351,13 @@
option.value = tool.toolName;
const commType = tool.integrationType ? tool.integrationType : 'HTTP';
option.textContent = tool.description ? `[${commType}] ${tool.description} (${tool.toolName})` : `[${commType}] ${tool.toolName}`;
option.dataset.schema = JSON.stringify(tool.parametersSchema);
option.dataset.schema = JSON.stringify(tool.inputSchema || tool.parametersSchema);
option.dataset.prompts = JSON.stringify(tool.actionPrompts || {});
optgroup.appendChild(option);
const enums = tool.parametersSchema?.properties?.action?.enum || [];
const descStr = tool.parametersSchema?.properties?.action?.description || "";
const schema = tool.inputSchema || tool.parametersSchema;
const enums = schema?.properties?.action?.enum || [];
const descStr = schema?.properties?.action?.description || "";
let descMap = {};
if(descStr.includes(":")) {

View File

@@ -331,7 +331,7 @@
function generateDummyPayload(tool) {
if (tool._customPayload) return tool._customPayload;
const schema = tool.parametersSchema;
const schema = tool.inputSchema || tool.parametersSchema;
if (!schema || !schema.properties) return {};
const payload = {};
for (const [key, value] of Object.entries(schema.properties)) {
@@ -705,7 +705,7 @@
}
function renderSmartForm(tool, payloadToUse = null) {
const schema = tool.parametersSchema;
const schema = tool.inputSchema || tool.parametersSchema;
const form = document.getElementById('payloadFormContainer');
form.innerHTML = '';
@@ -739,7 +739,7 @@
inputHtml = `<input type="text" data-key="${key}" data-type="string" value="${typeof val === 'object' ? JSON.stringify(val).replace(/"/g, '&quot;') : val}" class="bg-[#09090b] border border-[#3f3f46] text-white text-sm rounded p-2 w-full focus:border-blue-500 outline-none">`;
}
let reqStar = (schema.required && schema.required.includes(key)) ? '<span class="text-red-500">*</span>' : '';
let reqStar = ((tool.inputSchema || tool.parametersSchema)?.required?.includes(key)) ? '<span class="text-red-500">*</span>' : '';
html += `<div class="bg-[#18181b] p-4 rounded-lg border border-[#27272a]">
<label class="block text-sm font-medium text-slate-300 mb-2">${key} ${reqStar} <span class="text-xs text-zinc-500 font-mono font-normal ml-2">${typeLabel}</span></label>
${inputHtml}

View File

@@ -12,7 +12,9 @@ import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.HashSet;
import java.util.HashMap;
import io.shinhanlife.dap.lib.dto.OperationType;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Tool(Agent)의 명세 및 라우팅 정보를 담고 있는 메타데이터 클래스
* Redis 레지스트리에 저장되며, Planner와 Router 간의 통신 객체(Plan)로 사용됩니다.
@@ -55,6 +57,7 @@ public class ToolMetadata {
private List<String> requiredEnvKeys;
// 2. 파라미터 스키마 (JSON Schema 형태의 Map)
@JsonProperty("inputSchema")
private Map<String, Object> parametersSchema;
private Map<String, Object> outputSchema;
@@ -143,4 +146,31 @@ public class ToolMetadata {
if (parametersSchema == null || !parametersSchema.containsKey("required")) return Set.of();
return new HashSet<>((List<String>) parametersSchema.get("required"));
}
@JsonProperty("_meta")
public Map<String, Object> get_meta() {
Map<String, Object> meta = new HashMap<>();
meta.put("uid", this.uid);
meta.put("semver", this.semver);
meta.put("moduleName", this.moduleName);
meta.put("categoryKey", this.categoryKey);
meta.put("endpoint", this.endpoint);
meta.put("podUrl", this.podUrl);
meta.put("visible", this.visible);
meta.put("enabled", this.enabled);
meta.put("isRegistered", this.isRegistered);
meta.put("requiresApproval", this.requiresApproval);
meta.put("readOnlyHint", this.readOnlyHint);
meta.put("destructiveHint", this.destructiveHint);
meta.put("idempotentHint", this.idempotentHint);
meta.put("openWorldHint", this.openWorldHint);
meta.put("integrationType", this.integrationType);
meta.put("mciServiceId", this.mciServiceId);
meta.put("operationType", this.operationType);
meta.put("retryEnabled", this.retryEnabled);
meta.put("circuitBreakerFailureThreshold", this.circuitBreakerFailureThreshold);
meta.put("circuitBreakerOpenMillis", this.circuitBreakerOpenMillis);
meta.put("timeoutMillis", this.timeoutMillis);
return meta;
}
}