Problems with api request, and assitannt
# support
m
I am trying to use two tools in an assistant. One requests a token, the other uses this token and consumes another service. When I test only with the token tool, everything works perfectly, but when I configure both tools, neither the chat nor the call works. I store the token in a variable and insert it into the authorization of the other.
c
Hi Melissa, To address your issue with using two tools that involve managing a token, ensure the following: 1. **Verify Variable Storage**: Confirm that you correctly store the token as a dynamic variable using LiquidJS syntax. This stored token should be referenced in the authorization headers of your second tool. 2. **Check Tool Triggering**: Ensure that both tools are correctly configured in your assistant's model. Each tool should reference the exact names in prompts, e.g.,
get_token
and
use_token_service
, to ensure they are triggered accurately. 3. **Response Formatting**: Make sure the JSON responses from your tools adhere to the required structure, using single-line strings without line breaks, and always return HTTP 200 status. 4. **Token Handling in API Calls**: When using the token in the subsequent API calls, ensure it is dynamically inserted properly into request headers. 5. **Debug Call Logs**: Look for any errors in the call logs, such as "Schema validation errors" or "Token truncation warnings," to identify issues related to parameter handling or token size limits. You can refer to the detailed [troubleshooting guide](https://docs.vapi.ai/tools/custom-tools-troubleshooting) for more in-depth solutions. If these steps don't resolve the issue, reviewing the precise configurations in your Vapi dashboard might help pinpoint the problem. If this doesn’t resolve the issue, please let us know and we’ll be happy to step in and assist further.
m
Hi, i have this configuration in the api request token
when I run it alone, it works
and I have this other configuration in the other API that uses this variable
this is the promt of the assistant [Identity] Eres un agente de IA eficiente encargado de gestionar el proceso de autenticación de tokens con un enfoque orientado al detalle. [Style] - Mantén un tono profesional y claro. - Guía al usuario paso a paso con instrucciones concisas. [Response Guidelines] - Usa un lenguaje claro y directo. - Asegúrate de confirmar cada resultado antes de avanzar. [Task & Goals] 1. Saluda al usuario y confirma el inicio del proceso. 2. Ejecuta el primer tool "solicitar-token". - Indica si pudiste extraer el token y especifica en qué variable quedó almacenado el TOKEN. 3. Ejecuta el segundo tooll "api-token" [Error Handling / Fallback] - Si no logras extraer el token, informa al usuario de manera clara y ofrece repetir el intento. - Si la API devuelve un error, comunícalo y pregunta si deseas volver a intentarlo o finalizar el proceso.
and if I take the test through chat it always stays like this
hi
c
Thank you for providing this information. We’ll be looking into it further to better understand the situation and determine the next steps. Our team will update you as soon as we have more details, and we truly appreciate your patience and cooperation in the meantime.
While we look into this here are some key points to help resolve your issue: 1. For multiple tools scenarios: - Tools must return results in the same order as calls were triggered - All results should be included in a single response structure - Use HTTP 200 even if some individual tools error 2. Check your response format:
Copy code
{
  "results": [
    {
      "toolCallId": "call_1",
      "result": "First tool success (token)"
    },
    {
      "toolCallId": "call_2",
      "result": "Second tool success (using token)"
    }
  ]
}
3. Common issues to verify: - Check that both tools have proper schema validation - Ensure tool call IDs match exactly - Verify your response format doesn't contain line breaks - Make sure token passing between tools is properly formatted If you're storing the token in a variable, make sure: - The token tool completes successfully before the second tool tries to use it - The authorization header format is correct - Error handling is in place for cases where the token isn't available
m
todo esta asi, y sigo con los mismos problemas
c
Hello, there are a few key things to check when working with multiple tools: 1. Response Format: When handling multiple tools, you must return all results in the same order as the calls were triggered:
Copy code
{
  "results": [
    {
      "toolCallId": "call_1",
      "result": "First tool success"
    },
    {
      "toolCallId": "call_2",
      "result": "Second tool success"
    }
  ]
}
2. Async vs Sync Behavior: Consider whether you need sync or async behavior for your tools: - For token fetching + API calls, sync tools (
async: false
) are recommended since you need the token before making the second call [1](https://docs.vapi.ai/tools/custom-tools-troubleshooting) 3. Common Issues to Check: - Verify both tools return HTTP 200, even for errors - Ensure you're using single-line strings without line breaks - Check that toolCallId matches exactly between request and response - Validate your JSON response structure - Make sure you have sufficient token limits set (
maxTokens
) Try reviewing your logs for specific error messages like: - "ok, no result returned" - "Tool call ID mismatches" - "Schema validation errors" - "Response parsing errors"
2 Views