MCPcopy Create free account
hub / github.com/agentrpc/agentrpc / registerMachine

Function registerMachine

sdk-node/src/polling.ts:242–270  ·  view source on GitHub ↗
(
  client: ReturnType<typeof createApiClient>,
  tools?: ToolRegistrationInput<any>[],
)

Source from the content-addressed store, hash-verified

240}
241
242export const registerMachine = async (
243 client: ReturnType<typeof createApiClient>,
244 tools?: ToolRegistrationInput<any>[],
245) => {
246 log("registering machine", {
247 tools: tools?.map((f) => f.name),
248 });
249 const registerResult = await client.createMachine({
250 body: {
251 tools: tools?.map((func) => ({
252 name: func.name,
253 description: func.description,
254 schema: JSON.stringify(
255 isZodType(func.schema) ? zodToJsonSchema(func.schema) : func.schema,
256 ),
257 config: func.config,
258 })),
259 },
260 });
261
262 if (registerResult?.status !== 200) {
263 log("Failed to register machine", registerResult);
264 throw new AgentRPCAPIError("Failed to register machine", registerResult);
265 }
266
267 return {
268 clusterId: registerResult.body.clusterId,
269 };
270};
271
272export const pollForJobCompletion = async (
273 client: ReturnType<typeof createApiClient>,

Callers 2

startMethod · 0.85
pollIterationMethod · 0.85

Calls 1

isZodTypeFunction · 0.90

Tested by

no test coverage detected