MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / policyPrefixForTool

Function policyPrefixForTool

packages/plugins/toolkits/src/page.tsx:212–234  ·  view source on GitHub ↗
(tool: ToolRow)

Source from the content-addressed store, hash-verified

210};
211
212const policyPrefixForTool = (tool: ToolRow): string => {
213 const matchId = toolMatchId(tool);
214 const integration = String(tool.integration);
215 if (tool.connection && tool.connection.length > 0) {
216 const connection = String(tool.connection);
217 if (tool.owner) {
218 const ownerConnectionPrefix = `${integration}.${tool.owner}.${connection}`;
219 if (matchId === ownerConnectionPrefix || matchId.startsWith(`${ownerConnectionPrefix}.`)) {
220 return ownerConnectionPrefix;
221 }
222 }
223 const connectionPrefix = `${integration}.${connection}`;
224 if (matchId === connectionPrefix || matchId.startsWith(`${connectionPrefix}.`)) {
225 return connectionPrefix;
226 }
227 }
228 const name = String(tool.name);
229 if (name.length > 0 && matchId.endsWith(`.${name}`)) {
230 return matchId.slice(0, -name.length - 1);
231 }
232 const segments = matchId.split(".");
233 return segments.length > 1 ? segments.slice(0, -1).join(".") : matchId;
234};
235
236const connectionPatternForTool = (tool: ToolRow): string => `${policyPrefixForTool(tool)}.*`;
237

Callers 1

connectionPatternForToolFunction · 0.85

Calls 1

toolMatchIdFunction · 0.85

Tested by

no test coverage detected