Skip to main content
Glama

create_csp

Define contextual security policies for AI agents at tenant, team, agent, or user scope, with schedule, behavior, data, and custom rules.

Instructions

Cria uma nova política de segurança contextual (CSP).

Escopos: tenant (global), team, agent, user — herança automática de cima para baixo. Tipos: schedule (horários), behavior (comportamento), data (dados), origin (origens), custom.

⚠️ Campo fora do contrato é ACEITO em silêncio (o schema permite propriedades extras) e fica INERTE. Não invente nome de campo: leia zihin://schemas/csp_config e use exatamente os de $defs.{tipo}Rules.

Exemplos de rules por tipo (todos os campos abaixo existem no contrato E são aplicados):

  • schedule: { allowed_hours: { start: "08:00", end: "18:00" }, allowed_days: ["mon","tue","wed","thu","fri"], blocked_dates: ["2026-12-25"], timezone: "America/Sao_Paulo" }

  • behavior: { max_tokens_per_request: 4096, max_iterations: 10, max_tool_calls: 20, must_not_tools: ["web_search","fetch_url"] }

  • data: { sensitive_fields: ["cpf","email"], never_expose: ["password_hash"], restricted_entities: ["folha_pagamento"], restriction_message: "Não posso consultar esse dado." }

  • custom: qualquer shape — é passado ao prompt como bloco de política sem interpretação do runtime.

Controle de superfície de tools (behavior):

  • must_not_tools: nomes de tools que o agente NUNCA executa, mesmo carregadas. Filtrado antes do turno no runtime (inclusive no resume de HITL). É o único jeito de tirar uma tool nativa do agente sem desligar o recurso no tenant.

⚠️ policy_type "origin" NÃO é aplicado em runtime: nenhum entrypoint propaga o IP/origem do cliente até o loop, e countries/vpn/tor exigem provedor de geo que a plataforma não integra. A CSP é aceita e armazenada, mas não bloqueia nada — não use como controle de segurança.

Contrato formal: resource zihin://schemas/csp_config (envie só name/policy_type/scope/rules/... — tenant_id é injetado pelo servidor).

Aprovação por escopo (OE-2a, só chat nativo) — campos de behavior:

  • require_approval_for: array de string (nome de tool) ou objetos { tool_name } | { mcp_server_id } | { source: "mcp"|"api"|"db" } — tools casadas exigem aprovação HITL antes de executar

  • approval_policy_id: UUID de política criada via create_approval_policy — define QUEM aprova (sem ela, aprova o próprio solicitante) Ex: behavior: { require_approval_for: ["create_deal", { source: "db" }], approval_policy_id: "" }

Input Schema

NameRequiredDescriptionDefault
nameYesNome da política
rulesYesRegras da política (estrutura varia por tipo — veja descrição acima)
scopeYesEscopo de aplicação
priorityNoPrioridade (maior = mais importante, default: 0)
exceptionsNoExceções às regras (mesma estrutura de rules, sobrescreve campos específicos)
descriptionNoDescrição da política
policy_typeYesTipo da política
scope_target_idNoID do alvo (obrigatório para escopos team, agent, user)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only cover the safety profile (readOnly=false, destructive=false, idempotent=false), and the description adds substantial behavioral context beyond that: unknown fields are silently accepted and left inert, tenant_id is server-injected, origin rules are stored but never enforced, and must_not_tools is filtered pre-turn including HITL resume. This is exactly the extra operational knowledge an agent needs.

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 with the core purpose, then organized under clear headings (Escopos, Tipos, per-type examples, surface control, warnings, approval). It is long, and the two repeated ⚠️ warnings plus overlapping origin/must_not_tools notes are somewhat verbose, but nearly every block carries non-redundant information.

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

Completeness5/5

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

For a nested-object, extra-properties-allowed tool with no output schema, the description supplies the contract reference, per-type rule examples, scope/heritage semantics, server-injected fields, and runtime-vs-stored caveats. An agent has everything needed to call it correctly without guessing field names.

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

Parameters5/5

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

Even with 100% schema coverage, the description adds real meaning: concrete per-type rule shapes for schedule/behavior/data/custom, the pointer to zihin://schemas/csp_config and $defs.{tipo}Rules for authoritative field names, and the note that tenant_id is injected rather than passed. This goes well beyond the schema's generic descriptions.

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+resource ("Cria uma nova política de segurança contextual (CSP)") and immediately enumerates the scopes and policy types it supports. An agent can distinguish this from update_csp/get_csp/delete_csp/toggle_csp without opening any 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 usage: enumerates when each policy_type applies (schedule/behavior/data/custom), and gives an explicit when-NOT-to-use warning that policy_type 'origin' is accepted but not enforced at runtime ("não use como controle de segurança"). It also points to the contract resource and the create_approval_policy sibling for approval policy IDs.

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

Deploy Server

Other Tools