Skip to main content
Glama

Criar novo grupo na disciplina (idempotente e compatível com mod_groupselect)

create_course_group
Idempotent

Creates a new Moodle course group with a chosen or auto-generated unique name, prevents overwriting existing groups, and associates a grouping when required.

Instructions

Cria um novo grupo em uma disciplina validando moodle/course:managegroups, permitindo escolher um nome explícito (sem nunca sobrescrever nem reutilizar grupos preexistentes) ou gerar automaticamente um nome único a partir dos grupos existentes. Se a atividade mod_groupselect exigir um agrupamento (targetgrouping > 0), associa o grupo automaticamente e confirma o estado final no Moodle antes de retornar.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "create_course_group"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoNome desejado para o novo grupo. Se omitido, gera automaticamente um nome único sequencial (ex: "Grupo 10") sem reutilizar lacunas nem duplicar grupos.
courseIdNoID da disciplina no Moodle (resolvido automaticamente se activityCmid for informado).
idnumberNoIdentificador externo opcional (idnumber) do grupo no Moodle.
groupingIdNoID opcional de agrupamento (grouping) ao qual associar o grupo recém-criado.
namePrefixNoPrefixo opcional para geração automática de nome (ex: "Grupo ").
descriptionNoDescrição opcional do grupo.
activityCmidNoCourse module ID (cmid) opcional da atividade mod_groupselect (ex: 1569070) onde o grupo deve ficar disponível.
enrolmentKeyNoChave de inscrição opcional do grupo.
idempotencyKeyNoChave opcional de idempotência para evitar criação duplicada em caso de repetição da chamada após timeout.
autoGenerateNameNoSe true (padrão quando name é omitido), gera nome único automaticamente.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A3.7/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing the required capability (moodle/course:managegroups), the guarantee that preexisting groups are never overwritten or reused, automatic grouping association for mod_groupselect, and a post-write verification step before returning. Annotations already cover idempotency and non-destructiveness, so the description adds the auth and safety context an agent actually 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?

Three dense sentences with the core action and safety guarantee front-loaded, followed by the mod_groupselect behavior. Slightly long and clause-heavy in the first sentence, but no filler or repetition.

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

Completeness3/5

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

Covers permissions, name generation, and grouping side effects for a 10-parameter, zero-required mutation tool. The notable gap is the return value: there is no output schema, yet the description only says it confirms final state in Moodle 'antes de retornar' without saying what is returned (group id, name, grouping association), leaving the agent to guess how to chain the result.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it explains the name/autoGenerateName fallback logic and clarifies the relationship between activityCmid and groupingId through the targetgrouping > 0 condition. It does not clarify idempotencyKey or enrolmentKey behavior beyond what the schema states.

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

Purpose4/5

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

States a specific verb and resource ('Cria um novo grupo em uma disciplina') and adds the two operating modes (explicit name vs. auto-generated unique name). It is clearly distinct from read siblings like get_course_groups, but it never names the closest alternative, create_group_with_members, so an agent must infer that distinction from the tool name alone.

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

Usage Guidelines3/5

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

Implied usage is present: use it to create a group, omit 'name' to auto-generate one, and it hooks into mod_groupselect when targetgrouping > 0. However there is no explicit 'use X instead when you also need to add members' routing to create_group_with_members, and no stated exclusions, so the agent must infer the boundary.

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