Skip to main content
Glama

editar_produto

Update an existing product's name, price, and inventory by specifying its product ID.

Instructions

Atualiza dados de um produto existente.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
id_produtoYes
nomeNo
precoNo
estoqueNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler for the 'editar_produto' tool. It receives id_produto (required) and optional nome, preco, estoque fields, filters out None values, and delegates to database.atualizar_registro to UPDATE the produtos table.
    @mcp.tool()
    def editar_produto(id_produto: int, nome: str = None, preco: float = None, estoque: int = None) -> str:
        """Atualiza dados de um produto existente."""
        dados = {k: v for k, v in {"nome": nome, "preco": preco, "estoque": estoque}.items() if v is not None}
        return database.atualizar_registro("produtos", id_produto, **dados)
  • server.py:104-104 (registration)
    The tool is registered via the @mcp.tool() decorator on the editar_produto function, which uses FastMCP to expose it via the MCP protocol.
    @mcp.tool()
  • The helper function 'atualizar_registro' is called by editar_produto. It builds a dynamic SQL UPDATE statement for the given table and record ID, setting only the provided columns.
    def atualizar_registro(tabela, registro_id, **kwargs):
        conn = sqlite3.connect(DB_NAME)
        cursor = conn.cursor()
        
        set_clause = ', '.join([f"{k} = ?" for k in kwargs.keys()])
        sql = f"UPDATE {tabela} SET {set_clause} WHERE id = ?"
        cursor.execute(sql, list(kwargs.values()) + [registro_id])
        conn.commit()
        conn.close()
        return f" {tabela.capitalize()} ID {registro_id} atualizado!"
  • The input schema is defined via type hints in the function signature: id_produto (int, required), nome (str, optional), preco (float, optional), estoque (int, optional).
    def editar_produto(id_produto: int, nome: str = None, preco: float = None, estoque: int = None) -> str:
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits such as idempotency, error handling (e.g., product not found), or required permissions. It only says 'updates data'.

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

Conciseness2/5

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

The description is a single sentence, but it is under-specified. Conciseness is achieved at the cost of missing critical information for an agent to use the tool effectively.

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

Completeness2/5

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

Given the tool has 4 parameters, no schema descriptions, and no annotations, the description is insufficient. It does not explain how to use the parameters or what the output contains, even though an output schema exists.

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

Parameters1/5

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

With 0% schema description coverage, the description must compensate but fails to add any meaning to the 4 parameters. It does not explain what each parameter (id_produto, nome, preco, estoque) represents or how they are used.

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?

The description clearly states it updates existing product data using the verb 'atualiza' and resource 'produto existente'. It distinguishes from sibling tools like 'cadastrar_produto' (create) and 'remover_produto' (remove).

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like 'atualizar_endereco_direto' or 'cadastrar_produto'. The description only states what it does without context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mateus-gondev/MCP-PIE'

If you have feedback or need assistance with the MCP directory API, please join our Discord server