Documentation
¶
Overview ¶
Package conversions provides bidirectional type conversion between Go values and Starlark values, MCP result parsing, and tool name sanitization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoToStarlark ¶
GoToStarlark converts a Go value to a Starlark value.
func ParseToolResult ¶
func ParseToolResult(result *mcp.CallToolResult) (interface{}, error)
ParseToolResult converts an mcp.CallToolResult into a Go value suitable for Starlark consumption.
It handles multiple response formats:
- Structured content with the mcp-go SDK {"result": v} wrapper pattern
- Structured content without the wrapper
- Text content parsed as JSON
- Plain text returned as-is
- Multi-item responses (first text item used)
- Error results returned as an error
func SanitizeName ¶
SanitizeName converts an MCP tool name into a valid Starlark identifier. Characters that are not alphanumeric or underscore are replaced with underscores. Leading digits get a prefix underscore.
func StarlarkToGo ¶
StarlarkToGo converts a Starlark value to a Go value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.