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

Function rowToTool

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

Source from the content-addressed store, hash-verified

912// schema columns); `Tool.inputSchema`/`outputSchema` are optional and stay
913// absent for those callers — `tools.schema` is the schema-bearing surface.
914const rowToTool = (
915 row: ToolInvocationRow & Partial<Pick<ToolRow, "input_schema" | "output_schema">>,
916 annotations?: ToolAnnotations,
917): Tool => {
918 const owner = row.owner as Owner;
919 const integration = IntegrationSlug.make(row.integration);
920 const connection = ConnectionName.make(row.connection);
921 const name = ToolName.make(row.name);
922 return {
923 address: toolAddress(owner, integration, connection, name),
924 owner,
925 integration,
926 connection,
927 name,
928 pluginId: row.plugin_id,
929 description: row.description,
930 inputSchema: decodeJsonColumn(row.input_schema),
931 outputSchema: decodeJsonColumn(row.output_schema),
932 annotations: annotations ?? (decodeJsonColumn(row.annotations) as ToolAnnotations | undefined),
933 };
934};
935
936// ---------------------------------------------------------------------------
937// 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