Help us shape the future of Go! Take the 2026 Go Developer Survey

mcpdocs

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package mcpdocs writes a Markdown reference of an MCP server — its tools, prompts, resources and instructions — from what the server sends over the protocol, so it works for any server regardless of language and SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstDifference

func FirstDifference(written, rendered string) int

FirstDifference compares a written reference with a freshly rendered one and returns the first line that differs, or 0 if they match. Line endings are ignored, so a checkout with CRLF still matches.

func Render

func Render(srv *Server) (string, error)

Render writes the reference. The text holds no date or version, so it changes only when what the server offers changes — which keeps --check meaningful.

func UndescribedParams

func UndescribedParams(toolName string, inputSchema any) []string

UndescribedParams names the input parameters of a tool's inputSchema that have no description, as "tool.param". The model can only guess what they are for.

Types

type Prompt

type Prompt struct {
	Name        string `json:"name"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Arguments   []struct {
		Name        string `json:"name"`
		Description string `json:"description"`
		Required    bool   `json:"required"`
	} `json:"arguments"`
}

Prompt is a prompt as listed by prompts/list.

type Resource

type Resource struct {
	URI         string `json:"uri"`
	URITemplate string `json:"uriTemplate"`
	Name        string `json:"name"`
	Title       string `json:"title"`
	Description string `json:"description"`
	MIMEType    string `json:"mimeType"`
}

Resource is a resource or a resource template.

type Server

type Server struct {
	Name         string
	Instructions string
	Tools        []Tool
	Prompts      []Prompt
	Resources    []Resource
	Templates    []Resource
	// Whether the server declares the capability; a section is written only then
	HasTools, HasPrompts, HasResources bool
}

Server is what the reference is written from.

func Fetch

func Fetch(ctx context.Context, session *mcp.ClientSession) (*Server, error)

Fetch reads everything the reference shows from a connected session. A list fails the fetch only if the server declares its capability.

type Tool

type Tool struct {
	Name         string          `json:"name"`
	Title        string          `json:"title"`
	Description  string          `json:"description"`
	InputSchema  json.RawMessage `json:"inputSchema"`
	OutputSchema json.RawMessage `json:"outputSchema"`
	Annotations  *struct {
		Title           string `json:"title"`
		ReadOnlyHint    *bool  `json:"readOnlyHint"`
		DestructiveHint *bool  `json:"destructiveHint"`
		IdempotentHint  *bool  `json:"idempotentHint"`
		OpenWorldHint   *bool  `json:"openWorldHint"`
	} `json:"annotations"`
}

Tool is a tool as listed by tools/list; the schemas stay raw so their properties keep the server's order.

Jump to

Keyboard shortcuts

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