Design operations around tasks
Instead of exposing generic query execution or arbitrary URL fetching, provide narrow business functions. Reading an authorised order, preparing an amendment and executing an approved update are different contracts. Parameters should represent the permitted task rather than the target system's full capabilities.
The broader the interpreter behind a tool, the harder its boundaries are to demonstrate. Generated text should not become SQL, a shell command or an unrestricted database filter. The application should construct operations from approved fields and parameterised queries, keeping model-supplied values as data.
Validate meaning as well as types
Schemas should reject unknown fields, unexpected objects, excessive lengths and out-of-range values. Format checks are insufficient: a technically valid identifier may refer to someone else's resource or an object in the wrong state. Validate both the type and the actor's relationship to the identified resource.
Organisation and identity context should come from the application. The model must not decide whose authority it holds. If an organisation parameter is accepted, the server should compare it with the actual session scope rather than treating the argument as evidence of permission.
Separate preparation from commitment
For consequential actions, a preparation stage can validate inputs and describe a specific operation without executing it. Human or policy approval should bind to that version, recipient and scope. Changing arguments afterwards requires reassessment.
In an illustrative scenario, an assistant prepares a delivery-address amendment. Before execution, the order enters fulfilment. The earlier preview is insufficient: the tool must check current state again. This prevents an approval being reused after its assumptions expire.
Include failures and cost in the contract
| Property | Design question |
|---|---|
| Scope | Which resources and fields may change? |
| Authorisation | Who may perform this operation now? |
| Idempotency | What represents repetition of the same intent? |
| Budget | How much work and time can a call consume? |
| Outcome | How is the effect confirmed in the target system? |
Limit response size and call count too. A read tool can expose excessive information or overload a system without changing anything. Pagination and field selection should follow task requirements. Returning an entire directory for every question makes access control and cost management harder.
Keep credentials outside model context
Keys, tokens and authentication material should remain in the execution layer. The model needs a result, not the credentials used to obtain it. Error responses should not expose full queries, headers or another customer's data. Apply the same discipline in testing, where overly detailed diagnostics can become normal operating practice.
A tool refusal should be unambiguous. The model should not interpret denied access as a suggestion to try broader permissions. The application can explain a limitation without exposing an uncontrolled alternative execution route.
Test valid arguments used incorrectly
Beyond malformed types, exercise well-formed requests against another organisation, stale state and operations beyond the user's role. Test concurrent execution, expired approvals and recipient changes. Verify the absence of an effect after rejection, not merely the wording of an error.
Consider the response contract as well. A tool should distinguish completed, rejected, pending and uncertain outcomes. Otherwise, the model may confidently describe a successful action when the execution layer only accepted a request for later processing.
Adding a field can expand process authority. Treat it as a contract change requiring security review, regression checks and updated agent evaluation, rather than a harmless extension of a function description.
Validate the output contract
A tool should return only what the next stage needs. Information hidden in the user interface but present in an API response can still enter model context. For customer lookup, define a dedicated response model instead of serialising the full database object. Apply this to diagnostic fields and relationships with other resources too.
During acceptance, use two legitimate identities and resources with similar identifiers. Compare every returned field, not only response status. Then verify that denial messages do not disclose another actor's record. A narrow input contract without equally careful output design leaves an important gap.
Build controlled AI integrations with Geekforce
We can design narrow tools, enforcement layers and integrations for your AI assistants. Together, we can improve business operations while ensuring the model can perform only the actions genuinely needed by the agreed process.


