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

Function parseToolAddress

packages/core/sdk/src/executor.ts:216–241  ·  view source on GitHub ↗
(address: string)

Source from the content-addressed store, hash-verified

214 * `tools.<integration>.<owner>.<connection>.aliases.deleteAlias` — the same
215 * dotted nesting the sandbox `tools` proxy produces from property access. */
216export const parseToolAddress = (address: string): ParsedToolAddress | null => {
217 // Walk to the 4th dot; everything past it is the tool (dots and all).
218 let cut = -1;
219 for (let i = 0; i < 4; i++) {
220 cut = address.indexOf(".", cut + 1);
221 if (cut === -1) return null;
222 }
223 const [prefix, integration, owner, connection] = address.slice(0, cut).split(".") as [
224 string,
225 string,
226 string,
227 string,
228 ];
229 const tool = address.slice(cut + 1);
230 if (prefix !== ADDRESS_PREFIX) return null;
231 if (!isOwner(owner)) return null;
232 if (integration.length === 0 || connection.length === 0 || tool.length === 0) {
233 return null;
234 }
235 return {
236 integration: IntegrationSlug.make(integration),
237 owner,
238 connection: ConnectionName.make(connection),
239 tool: ToolName.make(tool),
240 };
241};
242
243export const connectionAddress = (
244 owner: Owner,

Callers 4

pathToAddressFunction · 0.90
toolSchemaFunction · 0.85
policiesResolveFunction · 0.85
executeFunction · 0.85

Calls 1

isOwnerFunction · 0.85

Tested by

no test coverage detected