Native Visual Tool Calling: Bridging the Gap from Perception to Execution

    While multimodal models excel at visual understanding, converting these insights into executable actions remains challenging. Traditional approaches suffer from information loss and error accumulation due to intermediate text conversions. Native visual tool calling addresses this by allowing models to process images directly and use them as tool parameters or context within a single inference loop. This article explores the core design principles, workflow, engineering implementation details, common use cases, risk management, and evaluation metrics for building robust native visual tool calling systems.

    1. Background: From “Understanding Images” to “Acting on Images”

    The progress of multimodal models in recent years has primarily focused on visual understanding, such as recognizing chart data, reading document layouts, and describing interface elements. However, in real-world applications, understanding is just the first step. Systems usually need to call tools, query databases, submit forms, or generate reports based on visual information—translating “what is seen” into “actions to execute.”

    Traditional solutions often adopt a phased approach. The vision model first converts the image into a text description, which is then passed to a rule engine or another language model for parsing, and finally to an external interface. This pipeline has three obvious problems:

    1. Information Loss: Details such as colors, positional relationships, and table structures in the image are easily lost during text conversion.
    2. Error Accumulation: Recognition errors from the previous stage propagate to every subsequent step, making it difficult to locate the root cause.
    3. Pipeline Complexity: Every new visual input or output format requires additional conversion logic, increasing maintenance costs.

    Native multimodal tool calling attempts to solve these problems. The idea is to let the model process image inputs directly within the same inference process and directly understand tool return results in image formats, thereby reducing intermediate conversion steps.

    2. Core Design Principles

    This approach can be summarized in two principles.

    2.1 Image as Parameter

    Visual objects such as images, screenshots, and document pages can be directly used as parameters for tool calls. When generating a call request, the model does not need to translate the image into text before filling in the parameters. For example, if a user uploads a screenshot of a report and requests data export, the model can directly pass the screenshot as a parameter to a data extraction tool, letting the tool process the image content itself.

    The value of this approach lies in preserving original information. Details like chart axes, unit annotations, and color legends are passed along with the image, reducing misjudgments caused by incomplete descriptions.

    2.2 Result as Context

    Tool return results can also be in visual forms, such as statistical charts, rendered web page screenshots, or retrieved product images. The model can perform visual understanding on these returned results again and incorporate the understood content into subsequent reasoning.

    This forms a complete closed loop of “perceive, understand, execute.” The model first understands the input, then calls a tool to obtain new visual feedback, and then bases its next action on that feedback until the task is completed.

    3. Complete Workflow

    A typical multimodal tool call can be broken down into the following steps:

    1. Receive Input: The user provides text instructions and one or more images.
    2. Generate Call: The model determines whether a tool is needed. If so, it outputs the tool name and parameters, where parameters can include image references.
    3. Validate and Execute: The runtime checks parameter formats, permissions, and rate limits. If passed, the tool is executed.
    4. Backfill Result: The tool returns text or images, and the runtime writes this into the context.
    5. Continue Reasoning: Based on the latest context, the model decides whether to continue calling tools or output the final answer directly.

    This workflow is consistent with a standard agentic loop, except that images can serve as both input parameters and intermediate results that continuously participate in reasoning.

    4. Engineering Implementation Points

    4.1 Tool Description Design

    The tool description determines whether the model can call the tool correctly. Descriptions should include clear functional explanations, parameter types, value ranges, and required fields. For image parameters, the expected form of the image content should also be specified, such as “single chart screenshot” or “full web page screenshot.”

    Below is a schematic tool definition. The field names are used to illustrate the structure and are not specifications of any specific API:

    1. {
    2. "name": "extract_chart_data",
    3. "description": "Extract data points from a chart screenshot and return a structured table",
    4. "parameters": {
    5. "type": "object",
    6. "properties": {
    7. "image": {
    8. "type": "image",
    9. "description": "Chart screenshot containing axes and legends"
    10. },
    11. "chart_type": {
    12. "type": "string",
    13. "enum": ["bar", "line", "pie"],
    14. "description": "Chart type, used to select parsing strategy"
    15. }
    16. },
    17. "required": ["image"]
    18. }
    19. }

    The more specific the description, the lower the probability of the model misusing the tool. Avoid using vague tool names like “process” or “handle.”

    4.2 Parameter Validation

    Parameters generated by the model cannot be trusted directly. The runtime should complete the following checks before execution:

    • Type Check: Whether the image parameter is in a parseable format, and whether the text parameter conforms to the enum range.
    • Size and Quantity Limits: The number and resolution of images in a single request should have an upper limit to prevent resource exhaustion.
    • Permission Check: Whether the current user is allowed to call the tool, and if the image contains sensitive information, whether it complies with data processing regulations.

    Upon validation failure, the error message should be returned to the model as text, giving the model a chance to correct the parameters and retry.

    4.3 Visual Result Backfill

    When a tool returns an image, the runtime needs to explicitly tag its source and type so the model can distinguish between “user-uploaded images” and “tool-generated images.” At the same time, a brief text description should be appended to the returned image, such as “page screenshot rendered in step 3,” to help the model understand the context.

    4.4 Context Management

    Images consume a significant amount of context space. After multiple rounds of calls, the context can expand rapidly. Common management strategies include:

    • Only retaining historical images relevant to the current task; older screenshots can be replaced with text summaries.
    • Reasonably scaling down oversized images to reduce data volume while preserving the clarity of key regions.
    • Setting a maximum number of reasoning steps to prevent the model from getting stuck in a repetitive calling loop.

    5. Pseudocode: Agent Loop

    The pseudocode below demonstrates the basic control logic at runtime. It does not depend on any specific framework and focuses on illustrating how image results are backfilled into the context.

    1. function run_agent(user_query, user_image, tools, model):
    2. context = [user_query, user_image]
    3. for step in 1..MAX_STEPS:
    4. reply = model.generate(context, tools)
    5. if reply.tool_call is None:
    6. return reply.text
    7. validate_arguments(reply.tool_call, tools) # Parameter validation
    8. result = execute_tool(reply.tool_call) # Execute in a controlled environment
    9. context.append(reply.tool_call)
    10. if result.is_image:
    11. context.append(label(result.image, result.description)) # Visual result backfill
    12. else:
    13. context.append(result.text)
    14. raise Error("Maximum reasoning steps exceeded, task terminated")

    There are two key points in this structure. First, validation occurs before execution, preventing incorrect parameters from directly affecting external systems. Second, image results are backfilled with descriptive tags, enabling the model to distinguish visual information from different sources.

    6. Typical Use Cases

    6.1 Product Information Retrieval and Comparison

    A user uploads a photo of a product, and the system calls a retrieval tool to find similar items. The retrieval results are returned as images. The model compares appearance, materials, and price areas, then outputs a comparison conclusion. The entire process requires no manual conversion of images into keywords.

    6.2 Web and Interface Verification

    In automated testing, tools can render pages and return screenshots. The model checks whether the button positions, text content, and layout in the screenshot meet expectations, and based on this, determines whether the test passes or generates a defect description.

    6.3 Report Analysis

    A user provides a screenshot of a business report and asks to summarize key metrics. The model first calls a data extraction tool to obtain structured results, then reads the trend chart returned by the tool, combining both to provide an analysis.

    6.4 Document Processing

    For scanned documents or documents with complex layouts, the model can directly read the page image, locate form fields, and call a write tool to complete data entry.

    7. Risks and Controls

    Native multimodal calling expands the capabilities of agents but also introduces new risks.

    1. Misrecognition Leading to Wrong Calls: When images are blurry, occluded, or low resolution, the model may select incorrect parameters. Mitigation methods include requiring the model to state its rationale before calling and adding human confirmation for high-risk operations.
    2. Unauthorized Operations: The model might call tools it should not execute under the guidance of visual content. The principle of least privilege should be adopted, granting each tool only the capabilities necessary to complete the task.
    3. Privacy Leaks: Screenshots may contain faces, ID numbers, or internal data. Desensitization should be applied during transmission and storage, and image retention time should be limited.
    4. Duplicate Execution: Retries after network timeouts may cause write operations to be executed twice. Write-type tools should be designed as idempotent interfaces, or the runtime should log request IDs.
    5. Prompt Injection: Text within an image might contain instructions that induce the model to perform unintended actions. The runtime should treat image content as data, not instructions, and apply extra validation to sensitive actions.

    8. Evaluation Methods

    When evaluating multimodal tool calling, it is not advisable to look only at whether the final answer is correct. It is recommended to establish metrics across the following dimensions:

    • Tool Selection Accuracy: Whether the model called the correct tool in the correct scenario.
    • Parameter Correctness: Whether the image and text parameters meet expectations, which can be calculated through manual sampling and labeling.
    • Task Completion Rate: Whether the end-to-end task meets the acceptance criteria.
    • Step Efficiency: The average number of calls required to complete a task, used to measure whether the pipeline is redundant.
    • Latency and Cost: Including inference time, tool execution time, and additional overhead brought by image processing.

    The evaluation set should cover both normal and edge samples, such as low-resolution images, multi-image mixed inputs, and tool return errors. Only when performance is stable in these scenarios is the solution suitable for production environments.

    9. Implementation Advice

    When introducing native multimodal tool calling, teams can proceed in the following order:

    1. First, choose a business scenario with clear inputs and verifiable outputs, such as report data extraction, as a pilot.
    2. Write clear descriptions and validation rules for each tool, and establish call logs for easy tracing.
    3. Complete full-pipeline testing in a sandbox environment before gradually opening up real data and write permissions.
    4. Adjust context strategies and maximum step limits based on evaluation metrics to form stable runtime parameters.

    The combination of visual perception and tool execution essentially advances models from “answering questions” to “completing tasks.” As long as rigorous practices are maintained in interface design, parameter validation, and risk control, this capability can function reliably across various business scenarios.