@amaster.ai/function-client
v1.1.27
Published
Function invocation client
Downloads
3,129
Readme
@amaster.ai/function-client
Function invocation client for AMaster edge functions.
import { createFunctionClient } from "@amaster.ai/function-client";
const client = createFunctionClient();
const result = await client.invoke<{ ok: boolean }>("sendEmail", {
to: "[email protected]",
});
if (result.error) {
console.error(result.error.message, result.invocationId);
}
if (result.data) {
console.log(result.data.ok);
}Invocation Metadata
invoke() returns the normal ClientResult fields plus edge runtime metadata:
| Field | Source header | Description |
| ----------------- | ---------------------------- | ------------------------------------------------------------------ |
| invocationId | X-AMaster-Invocation-Id | Unique id for this function call. Use it to query invocation logs. |
| functionVersion | X-AMaster-Function-Version | Function version selected by the runtime for this call. |
When a function behaves unexpectedly, keep result.invocationId with the
observed response and query the OpenTelemetry runtime logs by that exact id.
In agent-assisted debugging, use the Scheduler MCP runtime log search tool with
invocation_id:
{
"invocation_id": "inv_xxx",
"limit": 20
}For direct HTTP diagnostics, query the Scheduler logs API:
curl "http://localhost:8080/api/v1/logs/search?invocation_id=${invocationId}&limit=20"