Skip to main content
Glama
nilsond
by nilsond

finalizar_pedido

Finalizes a purchase by converting the customer's cart into a confirmed order, updating stock, and clearing the cart.

Instructions

Finaliza a compra: converte o carrinho em pedido, baixa o estoque e limpa o carrinho.

Confirme o carrinho com o cliente (ver_carrinho) antes de chamar esta tool.

Args: session_id: identificador do carrinho do cliente. endereco_entrega: endereço completo de entrega.

Returns: Pedido confirmado com número, itens, total, endereço e data/hora.

Erros: Carrinho vazio; endereço vazio ou incompleto.

Input Schema

NameRequiredDescriptionDefault
session_idYesIdentificador do carrinho do cliente, ex.: 'demo'. Use o mesmo valor em toda a compra.
endereco_entregaYesEndereço completo: rua, número, bairro, cidade/UF e CEP.

Output Schema

NameRequiredDescriptionDefault
idYes
itensYes
totalYes
statusYes
criado_emYesData/hora de criação em ISO 8601 (UTC).
session_idYes
total_formatadoYes
endereco_entregaYes
quantidade_itensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations by disclosing concrete side effects: the cart is converted, stock is decremented, and the cart is cleared, plus a list of error conditions. What is missing is an explicit statement that the operation is not idempotent and cannot be undone/replayed, which matters for a checkout finalizer with idempotentHint=false and destructiveHint=false.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded summary sentence, then prerequisite, then Args/Returns/Erros sections — easy to scan. The Args block is somewhat redundant given full schema coverage, which keeps it from a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutating checkout tool it covers the essential ground: side effects, prerequisite confirmation step, return payload contents, and failure modes. The gaps are non-idempotency/duplicate-order behavior and what state the cart is left in on partial failure, so it stops short of fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented in the input schema, including the 'use o mesmo valor em toda a compra' note for session_id and the address component breakdown. The Args section in the description largely restates that, adding no format or validation detail beyond the schema; baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Finaliza a compra: converte o carrinho em pedido') plus the side effects (baixa estoque, limpa carrinho), which distinguishes it from siblings like ver_carrinho or adicionar_ao_carrinho. An agent can identify this as the terminal checkout action without reading the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes the agent to the sibling 'ver_carrinho' and states the precondition of confirming the cart with the customer before calling. It also enumerates the blocking conditions (carrinho vazio, endereço vazio/incompleto), which doubles as a when-not-to-call signal.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.