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

Function rowToTool

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

Source from the content-addressed store, hash-verified

1207// schema columns); `Tool.inputSchema`/`outputSchema` are optional and stay
1208// absent for those callers — `tools.schema` is the schema-bearing surface.
1209const rowToTool = (
1210 row: ToolInvocationRow & Partial<Pick<ToolRow, "input_schema" | "output_schema">>,
1211 annotations?: ToolAnnotations,
1212): Tool => {
1213 const owner = row.owner as Owner;
1214 const integration = IntegrationSlug.make(row.integration);
1215 const connection = ConnectionName.make(row.connection);
1216 const name = ToolName.make(row.name);
1217 return {
1218 address: toolAddress(owner, integration, connection, name),
1219 owner,
1220 integration,
1221 connection,
1222 name,
1223 pluginId: row.plugin_id,
1224 description: row.description,
1225 inputSchema: decodeJsonColumn(row.input_schema),
1226 outputSchema: decodeJsonColumn(row.output_schema),
1227 annotations: annotations ?? (decodeJsonColumn(row.annotations) as ToolAnnotations | undefined),
1228 };
1229};
1230
1231// Projects a tool's annotations onto the schema view. Plugins persist extra
1232// keys alongside the declared contract (the mcp plugin stores its upstream tool

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