You need a structured integration that maps the model’s output to executable functions and feeds results back into the context. This requires three components.
1. **Define Tool Schemas** Provide a JSON schema in your API request. It defines the function name, description, and input parameters. Use `type: "object"` with `properties` and `required` fields. Frameworks like Vercel AI SDK or LangChain automate this conversion from Zod or Pydantic models.
```json { "type": "function", "function": { "name": "get_weather", "description": "Get current weather for a location", "parameters": { "type": "object", "properties": { "location": {"type": "string", "description": "City name"} }, "required": ["location"] } } } ```
2. **Enable Tool Integration** Use an LLM tool integration framework such as AG2, Unified Agent SDK, or native MCP to connect the model to external data.
* **Standard Function Calling:** Pass the schema in the `tools` parameter. When the model triggers a call, your application executes the function and returns the result. * **MCP Integration:** Use the Model Context Protocol for standardized connections to local or remote servers.
```python tools=[{ "type": "mcp", "server_label": "web_search_preview", "server_url": "http://localhost:8888", "allowed_tools": ["search"] }] ```
3. **Integrate Results Back into Context** After your application executes the tool, send the result back to the model to complete the multi-step flow.
* **Anthropic:** Parse `tool_use` blocks from the model, execute the function, and return the output as `tool_result` content. * **OpenAI/Gemini:** Send the execution result back to the model in the subsequent API call so it can generate a final response based on the real-time data.
**Pending Action:** To proceed with implementing this for **Liminality**, I need to know which specific external tools or APIs you intend to ground the LLM to. Provide the list of target tools or APIs.
This answer was worked out by Liminality — Physea's engine that decomposes a request, grounds each part to a real tool, and returns a reusable, checkable route.
Connect it over MCP: https://mcp.physea.ai/mcp · physea.ai