import {
isToolWrappedWithBeforeToolCallHook,
wrapToolWithBeforeToolCallHook,
} from "../agents/pi-tools.before-tool-call.js"; import type { AnyAgentTool } from "../agents/tools/common.js"; import { formatErrorMessage } from "../infra/errors.js";
type CallPluginToolParams = {
name: string;
arguments?: unknown;
};
function resolveJsonSchemaForTool(tool: AnyAgentTool): Record<string, unknown> { const params = tool.parameters; if (params && typeof params === "object" && "type" in params) { return params as Record<string, unknown>;
} return { type: "object", properties: {} };
}
export function createPluginToolsMcpHandlers(tools: AnyAgentTool[]) { const allowedTools = tools.filter((tool) => !tool.ownerOnly); const wrappedTools = allowedTools.map((tool) => { if (isToolWrappedWithBeforeToolCallHook(tool)) { return tool;
} // The ACPX MCP bridge should enforce the same pre-execution hook boundary // as the agent and HTTP tool execution paths. return wrapToolWithBeforeToolCallHook(tool);
}); const toolMap = new Map<string, AnyAgentTool>(); for (const tool of wrappedTools) {
toolMap.set(tool.name, tool);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.