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

Function rowToTool

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

Source from the content-addressed store, hash-verified

1012// schema columns); `Tool.inputSchema`/`outputSchema` are optional and stay
1013// absent for those callers — `tools.schema` is the schema-bearing surface.
1014const rowToTool = (
1015 row: ToolInvocationRow & Partial<Pick<ToolRow, "input_schema" | "output_schema">>,
1016 annotations?: ToolAnnotations,
1017): Tool => {
1018 const owner = row.owner as Owner;
1019 const integration = IntegrationSlug.make(row.integration);
1020 const connection = ConnectionName.make(row.connection);
1021 const name = ToolName.make(row.name);
1022 return {
1023 address: toolAddress(owner, integration, connection, name),
1024 owner,
1025 integration,
1026 connection,
1027 name,
1028 pluginId: row.plugin_id,
1029 description: row.description,
1030 inputSchema: decodeJsonColumn(row.input_schema),
1031 outputSchema: decodeJsonColumn(row.output_schema),
1032 annotations: annotations ?? (decodeJsonColumn(row.annotations) as ToolAnnotations | undefined),
1033 };
1034};
1035
1036// ---------------------------------------------------------------------------
1037// Condition builders

Callers 5

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