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

Function parseToolAddress

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

Source from the content-addressed store, hash-verified

196 * `tools.<integration>.<owner>.<connection>.aliases.deleteAlias` — the same
197 * dotted nesting the sandbox `tools` proxy produces from property access. */
198export const parseToolAddress = (address: string): ParsedToolAddress | null => {
199 // Walk to the 4th dot; everything past it is the tool (dots and all).
200 let cut = -1;
201 for (let i = 0; i < 4; i++) {
202 cut = address.indexOf(".", cut + 1);
203 if (cut === -1) return null;
204 }
205 const [prefix, integration, owner, connection] = address.slice(0, cut).split(".") as [
206 string,
207 string,
208 string,
209 string,
210 ];
211 const tool = address.slice(cut + 1);
212 if (prefix !== ADDRESS_PREFIX) return null;
213 if (!isOwner(owner)) return null;
214 if (integration.length === 0 || connection.length === 0 || tool.length === 0) {
215 return null;
216 }
217 return {
218 integration: IntegrationSlug.make(integration),
219 owner,
220 connection: ConnectionName.make(connection),
221 tool: ToolName.make(tool),
222 };
223};
224
225export const connectionAddress = (
226 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