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

Function rowToTool

packages/core/sdk/src/executor.ts:637–657  ·  view source on GitHub ↗
(
  row: ToolInvocationRow & Partial<Pick<ToolRow, "input_schema" | "output_schema">>,
  annotations?: ToolAnnotations,
)

Source from the content-addressed store, hash-verified

635// schema columns); `Tool.inputSchema`/`outputSchema` are optional and stay
636// absent for those callers — `tools.schema` is the schema-bearing surface.
637const rowToTool = (
638 row: ToolInvocationRow & Partial<Pick<ToolRow, "input_schema" | "output_schema">>,
639 annotations?: ToolAnnotations,
640): Tool => {
641 const owner = row.owner as Owner;
642 const integration = IntegrationSlug.make(row.integration);
643 const connection = ConnectionName.make(row.connection);
644 const name = ToolName.make(row.name);
645 return {
646 address: toolAddress(owner, integration, connection, name),
647 owner,
648 integration,
649 connection,
650 name,
651 pluginId: row.plugin_id,
652 description: row.description,
653 inputSchema: decodeJsonColumn(row.input_schema),
654 outputSchema: decodeJsonColumn(row.output_schema),
655 annotations: annotations ?? (decodeJsonColumn(row.annotations) as ToolAnnotations | undefined),
656 };
657};
658
659// ---------------------------------------------------------------------------
660// Condition builders

Callers 5

produceConnectionToolsFunction · 0.85
toolsListFunction · 0.85
toolSchemaFunction · 0.85
toolSuggestionsFunction · 0.85
executeFunction · 0.85

Calls 2

decodeJsonColumnFunction · 0.85
toolAddressFunction · 0.70

Tested by

no test coverage detected