catalog

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package catalog provides the embedded D2 v0.9.0 capability reference.

Index

Constants

View Source
const (
	Version            = "v0.9.0"
	DefaultSearchLimit = 8
	MaxSearchLimit     = 20
	ResourceMIMEType   = "text/markdown; charset=utf-8"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID      string `json:"id"`
	Title   string `json:"title"`
	Summary string `json:"summary"`
}

Category groups related D2 capabilities.

func ListCategories

func ListCategories() []Category

ListCategories returns all categories in display order.

type Entry

type Entry struct {
	ID         string   `json:"id"`
	CategoryID string   `json:"category_id"`
	Title      string   `json:"title"`
	Summary    string   `json:"summary"`
	URI        string   `json:"uri"`
	SourceURLs []string `json:"source_urls"`
}

Entry describes one reference document in the catalog.

func ListCategory

func ListCategory(categoryID string) []Entry

ListCategory returns entries in display order for an exact category ID.

func Lookup

func Lookup(id string) (Entry, bool)

Lookup returns the entry whose ID exactly matches id.

func Search(query string, limit int) []Entry

Search returns at most limit entries matching every query term. A non-positive limit uses DefaultSearchLimit; values above MaxSearchLimit are clamped.

type ResourceContent

type ResourceContent struct {
	URI      string `json:"uri"`
	MIMEType string `json:"mimeType"`
	Text     string `json:"text"`
}

ResourceContent is transport-neutral text suitable for an MCP resource response.

func ReadResource

func ReadResource(uri string) (ResourceContent, bool)

ReadResource returns embedded Markdown for an exact catalog URI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL