resource

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package resource handles MCP resource requests including list, read, subscribe, and unsubscribe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatchList

func DispatchList(
	req proto.Request, list proto.ResourceListResult,
) *proto.Response

DispatchList returns the pre-built resource list.

Parameters:

  • req: the MCP request
  • list: pre-built resource list result

Returns:

  • *proto.Response: resource list response

func DispatchRead

func DispatchRead(
	contextDir string, tokenBudget int, req proto.Request,
) *proto.Response

DispatchRead loads context and returns the requested resource content.

Parameters:

  • contextDir: path to the .context/ directory
  • tokenBudget: token budget for agent packet assembly
  • req: the MCP request containing the resource URI

Returns:

  • *proto.Response: resource content or error

func DispatchSubscribe

func DispatchSubscribe(
	req proto.Request, fn func(string),
) *proto.Response

DispatchSubscribe parses subscribe params and calls the provided subscribe function with the validated URI.

Parameters:

  • req: the MCP request containing the resource URI
  • fn: subscribe function to call with the URI

Returns:

  • *proto.Response: empty success or validation error

func DispatchUnsubscribe

func DispatchUnsubscribe(
	req proto.Request, fn func(string),
) *proto.Response

DispatchUnsubscribe parses unsubscribe params and calls the provided unsubscribe function with the validated URI.

Parameters:

  • req: the MCP request containing the resource URI
  • fn: unsubscribe function to call with the URI

Returns:

  • *proto.Response: empty success or validation error

Types

This section is empty.

Jump to

Keyboard shortcuts

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