# Look up an answer during a call

Give the voice agent a blocking Agent Worker when the caller needs the answer before continuing. This example looks up a branch's public opening hours.

## Prompt

```text
Give our phone agent a tool to check public branch hours while the caller waits. Use our tool server and show me a successful lookup in a fixture.
```

## Set up the Agent Worker

1. Call `connect_mcp` for the workspace’s CRM or scheduling server. If it returns `action_url`, give it to the owner. Once `get_mcp_connection` returns `ready`, choose a read-only tool from its catalog. The example server calls its tool `lookup_public_hours`, accepts `branch`, and returns `structuredContent.hours`. Substitute the actual name, input and output fields from your server in the binding, code and fixture.
2. Use `create_worker`. Set `name` to `Branch hours`, `code` to the JavaScript below, `daily_limit_usd` to the approved compute cap, and `max_call_cost_usd` to `"0"`. Add the following fields to the definition, using the returned connection ID.

```json
{"mcp":{"directory":{"connection_id":"mcpc_00000000000000000000000000000001","tools":["lookup_public_hours"]}},"tool":{"name":"branch_hours","description":"Check public opening hours for a branch.","mode":"blocking","parameters":{"type":"object","properties":{"branch":{"type":"string"}},"required":["branch"],"additionalProperties":false}}}
```

```js
export default async function (event, ctx) {
  const branch = event.arguments?.branch;
  if (event.type !== "call.tool_requested" || typeof branch !== "string" || !branch.trim()) {
    return { available: false };
  }
  const reply = await ctx.mcp.call("directory", "lookup_public_hours", { branch });
  const hours = reply.structuredContent?.hours;
  return typeof hours === "string" && hours ? { available: true, hours } : { available: false };
}
```

3. Send this event to `test_worker`. The fixture belongs inside `event`. Expect `{"available":true,"hours":"09:00–17:00"}` in the run result. A test uses prepaid compute and makes no provider request.

```json
{"type":"call.tool_requested","arguments":{"branch":"Downtown"},"mcp_fixtures":{"directory":{"lookup_public_hours":{"hours":"09:00–17:00"}}}}
```

4. Activate the tested version with `set_worker_state` after approval. In `place_call`, add `tools:[{"worker_id":"<returned ID>"}]` to `call`, alongside `to` and `prompt`. For incoming calls, use the same tools array in the number’s saved instructions. Tell the voice agent to use `branch_hours` and to say it could not confirm the hours if the tool times out, fails, or returns `available:false`. Blocking execution has an eight-second deadline. For slower work, use the [background playbook](/recipes/background-call-tool.md).
