0Pricing
MCP Academy · Aula

Recursos listados e com modelo

Ofereça entradas fixas e padrões gerados sob demanda.

Recursos listados e com modelo é uma aula grátis de MCP Academy no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de MCP Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de MCP Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Two Ways to Offer Data

MCP exposes data two ways: a listed resource with a fixed URI, or a templated one with placeholders. Knowing which to pick keeps your server clear.

Listed: Enumerable and Few

A listed resource has a concrete URI and shows up in resources/list. Use it when there are only a handful of known items the client can browse.

@mcp.resource("config://app")
def app_config() -> str:
    return read_config()

Templated: Infinite by Pattern

A templated resource uses curly-brace placeholders, so it covers countless URIs. It can't be listed in full, because the set is open-ended.

@mcp.resource("file://{path}")
def read_file(path: str) -> str:
    return open(path).read()

The Listing Difference

Clients call resources/list to discover fixed resources. Templates appear in a separate templates list instead, advertising the shape rather than concrete entries.

Browse vs Address

Think of it as browse vs address. Listed resources are like menu items you scan; templates are like typing an address you already know.

When the Set Is Small

If your data is a short, stable set, prefer listed resources. The model can see every option, which makes the right choice obvious to it.

When the Set Is Huge

If items number in the thousands, a template wins. Listing them all would flood the client, so you advertise the pattern and let it fill in values.

weather://{city}/today

Combine Both Freely

A real server often does both: a few listed entries for common data, plus templates for the long tail. They coexist happily side by side.

Help Discovery Along

Templates can't enumerate, but you can add a small listed index resource that points to popular URIs, giving the model useful starting points.

@mcp.resource("cities://index")
def cities() -> str:
    return "london, paris, tokyo"

Same Read, Either Way

However a URI is found, the client reads it the same way: one resources/read call. Listed or templated changes discovery, not how content is fetched.

Why This Matters

Choosing listed vs templated shapes how easily a model finds your data. Pick listed for browsing, templated for scale, and your server stays usable. 🎯

Quick Check

Which resource type should you use for thousands of items?

Recap

You learned that listed resources suit small browsable sets while templated ones scale to huge collections, and the two combine well. Next: notifying clients of updates. 🚀

Perguntas Frequentes

A aula “Recursos listados e com modelo” é grátis?

Sim — o texto completo de “Recursos listados e com modelo” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de MCP Academy, atualize para CoddyKit PRO. O curso de MCP Academy inclui 4 aulas no total.

O que vou aprender em “Recursos listados e com modelo”?

Ofereça entradas fixas e padrões gerados sob demanda. Você pratica MCP Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar MCP Academy?

Nenhuma experiência prévia é necessária. MCP Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.

Quanto tempo leva a aula “Recursos listados e com modelo”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de MCP Academy?

Sim. Cada aula de MCP Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. URIs de recursos parametrizadas
  2. Criar conteúdo no momento da leitura
  3. Recursos listados e com modelo
  4. Notificar clientes sobre atualizações
← Voltar para MCP Academy