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

Function rowToTool

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

Source from the content-addressed store, hash-verified

1193// schema columns); `Tool.inputSchema`/`outputSchema` are optional and stay
1194// absent for those callers — `tools.schema` is the schema-bearing surface.
1195const rowToTool = (
1196 row: ToolInvocationRow & Partial<Pick<ToolRow, "input_schema" | "output_schema">>,
1197 annotations?: ToolAnnotations,
1198): Tool => {
1199 const owner = row.owner as Owner;
1200 const integration = IntegrationSlug.make(row.integration);
1201 const connection = ConnectionName.make(row.connection);
1202 const name = ToolName.make(row.name);
1203 return {
1204 address: toolAddress(owner, integration, connection, name),
1205 owner,
1206 integration,
1207 connection,
1208 name,
1209 pluginId: row.plugin_id,
1210 description: row.description,
1211 inputSchema: decodeJsonColumn(row.input_schema),
1212 outputSchema: decodeJsonColumn(row.output_schema),
1213 annotations: annotations ?? (decodeJsonColumn(row.annotations) as ToolAnnotations | undefined),
1214 };
1215};
1216
1217// Projects a tool's annotations onto the schema view. Plugins persist extra
1218// keys alongside the declared contract (the mcp plugin stores its upstream tool

Callers 5

readToolsFunction · 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