Documentation
¶
Index ¶
- func AnalyzeSubsystemsTool() *mcp.Tool
- func BSLHelpTool() *mcp.Tool
- func ConfigurationInfoTool() *mcp.Tool
- func DumpObjectStructFunc(dumpDir string) onec.SubsystemStructFunc
- func DumpSubsystemForestFunc(dumpDir string) onec.SubsystemForestFunc
- func EventLogTool() *mcp.Tool
- func FormStructureTool() *mcp.Tool
- func FormatSearchResult(matches []dump.Match, total int, query string, mode dump.SearchMode, ...) string
- func HandleBSLHelp(_ context.Context, _ *mcp.CallToolRequest, input BSLHelpInput) (*mcp.CallToolResult, any, error)
- func MetadataTool() *mcp.Tool
- func NewAnalyzeSubsystemsHandler(client *onec.Client) mcp.ToolHandler
- func NewAnalyzeSubsystemsHandlerWithSource(client *onec.Client, src onec.SubsystemForestFunc) mcp.ToolHandler
- func NewConfigurationInfoHandler(client *onec.Client) mcp.ToolHandler
- func NewEventLogHandler(client *onec.Client) mcp.ToolHandler
- func NewFormStructureHandler(client *onec.Client, dumpDir string) mcp.ToolHandler
- func NewMetadataHandler(client *onec.Client) mcp.ToolHandler
- func NewObjectStructureHandler(client *onec.Client) mcp.ToolHandler
- func NewObjectStructureHandlerWithSource(client *onec.Client, sub onec.SubsystemStructFunc) mcp.ToolHandler
- func NewQueryHandler(client *onec.Client) mcp.ToolHandler
- func NewSearchCodeHandler(index *dump.Index) mcp.ToolHandler
- func NewValidateQueryHandler(client *onec.Client) mcp.ToolHandler
- func ObjectStructureTool() *mcp.Tool
- func QueryTool() *mcp.Tool
- func RegisterBSLHelp(s *mcp.Server)
- func SearchCodeTool() *mcp.Tool
- func ValidateQueryTool() *mcp.Tool
- type BSLHelpInput
- type MatchDisplay
- type MatchDisplayFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeSubsystemsTool ¶ added in v1.10.0
AnalyzeSubsystemsTool returns the MCP tool definition for analyze_subsystems.
The action parameter is intentionally free-text (no JSON enum): it is validated in the handler so an unknown value yields a clear, actionable error instead of a schema rejection.
func BSLHelpTool ¶
BSLHelpTool returns the Tool definition for bsl_syntax_help.
func ConfigurationInfoTool ¶
ConfigurationInfoTool returns the MCP tool definition for get_configuration_info.
func DumpObjectStructFunc ¶ added in v1.11.0
func DumpObjectStructFunc(dumpDir string) onec.SubsystemStructFunc
DumpObjectStructFunc returns an offline SubsystemStructFunc backed by the dump at dumpDir, or nil when dumpDir == "" so the get_object_structure handler stays fully live. The closure OWNS object_type == "Subsystem" (handled == true for every Subsystem outcome, success or error) and declines every other type (handled == false) so the handler serves those live: the dump has no attribute / tabular / enum reader.
func DumpSubsystemForestFunc ¶ added in v1.11.0
func DumpSubsystemForestFunc(dumpDir string) onec.SubsystemForestFunc
DumpSubsystemForestFunc returns an offline SubsystemForestFunc backed by the configuration dump at dumpDir, or nil when dumpDir == "" so the analyze_subsystems handler keeps its live HTTP path, byte-for-byte identical to today. A parse error (or a recovered panic) is surfaced verbatim; the handler never falls back to live when a source is present (offline-when-dump-present).
func EventLogTool ¶
EventLogTool returns the MCP tool definition for get_event_log.
func FormStructureTool ¶
FormStructureTool returns the MCP tool definition for get_form_structure.
func FormatSearchResult ¶
func FormatSearchResult(matches []dump.Match, total int, query string, mode dump.SearchMode, displayFn MatchDisplayFunc) string
FormatSearchResult formats search matches into markdown text.
displayFn is optional. When nil, each match's Module field is used as the display name with no prefix (community behavior). Callers that need to decorate module names (e.g. marking extension modules) can pass a custom MatchDisplayFunc.
func HandleBSLHelp ¶
func HandleBSLHelp(_ context.Context, _ *mcp.CallToolRequest, input BSLHelpInput) (*mcp.CallToolResult, any, error)
HandleBSLHelp is the handler for the bsl_syntax_help tool.
func MetadataTool ¶
MetadataTool returns the MCP tool definition for get_metadata_tree.
func NewAnalyzeSubsystemsHandler ¶ added in v1.10.0
func NewAnalyzeSubsystemsHandler(client *onec.Client) mcp.ToolHandler
NewAnalyzeSubsystemsHandler returns a ToolHandler that fetches the subsystem forest from the live 1C extension over /subsystems and runs the requested topology analysis on it. It is exactly the live-only case of NewAnalyzeSubsystemsHandlerWithSource: NewAnalyzeSubsystemsHandler(client) == NewAnalyzeSubsystemsHandlerWithSource(client, nil).
func NewAnalyzeSubsystemsHandlerWithSource ¶ added in v1.11.0
func NewAnalyzeSubsystemsHandlerWithSource(client *onec.Client, src onec.SubsystemForestFunc) mcp.ToolHandler
NewAnalyzeSubsystemsHandlerWithSource returns a ToolHandler that runs the topology analysis on a subsystem forest obtained either from an offline source or from the live 1C extension.
When src is non-nil the forest comes from src(ctx) and the 1C client is never contacted (offline path; a source error is surfaced verbatim). When src is nil the forest is fetched over HTTP with client.Get(ctx, "/subsystems", ...) and the behaviour is byte-for-byte identical to the legacy live path. Validation, analysis and formatting are shared, so a source and the live extension that yield the same forest yield identical output.
func NewConfigurationInfoHandler ¶
func NewConfigurationInfoHandler(client *onec.Client) mcp.ToolHandler
NewConfigurationInfoHandler returns a ToolHandler that fetches configuration info from 1C.
func NewEventLogHandler ¶
func NewEventLogHandler(client *onec.Client) mcp.ToolHandler
NewEventLogHandler returns a ToolHandler that reads the 1C event log.
func NewFormStructureHandler ¶
func NewFormStructureHandler(client *onec.Client, dumpDir string) mcp.ToolHandler
NewFormStructureHandler returns a ToolHandler that fetches form structure.
The 1C HTTP endpoint in the Enterprise/server context cannot enumerate the runtime UI tree (no access to ФормаКлиентскогоПриложения), so it returns only the form name and title - Elements/Commands/Handlers from it are always empty. The full structure is parsed from the local DumpConfigToFiles output (Form.xml) when --dump is configured.
Behaviour:
- Name/Title come from HTTP if available; dump fills them in otherwise.
- Elements/Commands/Handlers come from dump when --dump is set; otherwise the response contains only Name+Title (degraded but valid).
- If both HTTP and dump fail we return an error.
- dump-only failures (HTTP OK, dump broken) are logged at WARN so users can diagnose why enrichment did not happen, but do not fail the call.
func NewMetadataHandler ¶
func NewMetadataHandler(client *onec.Client) mcp.ToolHandler
NewMetadataHandler returns a ToolHandler that fetches the metadata tree from 1C.
func NewObjectStructureHandler ¶
func NewObjectStructureHandler(client *onec.Client) mcp.ToolHandler
NewObjectStructureHandler returns a ToolHandler that fetches object structure from the live 1C extension. It is exactly the live-only case of NewObjectStructureHandlerWithSource: NewObjectStructureHandler(client) == NewObjectStructureHandlerWithSource(client, nil).
func NewObjectStructureHandlerWithSource ¶ added in v1.11.0
func NewObjectStructureHandlerWithSource(client *onec.Client, sub onec.SubsystemStructFunc) mcp.ToolHandler
NewObjectStructureHandlerWithSource returns a ToolHandler that can serve some object types from an offline source and the rest from the live 1C extension.
When sub is non-nil it is consulted first with the requested (objectType, objectName): if it reports handled==true, its result is used verbatim (offline path, no HTTP; a source error is surfaced verbatim), which lets a single type (e.g. Subsystem) be served from an offline dump; if it reports handled==false, the handler falls through to the live request. When sub is nil, every type is fetched over HTTP with client.Get(ctx, "/object/<type>/<name>", ...), byte-for-byte identical to the legacy live path.
func NewQueryHandler ¶
func NewQueryHandler(client *onec.Client) mcp.ToolHandler
NewQueryHandler returns a ToolHandler that executes a read-only query in 1C.
func NewSearchCodeHandler ¶
func NewSearchCodeHandler(index *dump.Index) mcp.ToolHandler
NewSearchCodeHandler returns a ToolHandler that searches BSL code in a local dump.
func NewValidateQueryHandler ¶
func NewValidateQueryHandler(client *onec.Client) mcp.ToolHandler
NewValidateQueryHandler returns a ToolHandler that validates a 1C query syntax.
func ObjectStructureTool ¶
ObjectStructureTool returns the MCP tool definition for get_object_structure.
func RegisterBSLHelp ¶
RegisterBSLHelp registers the bsl_syntax_help tool on the given server.
func SearchCodeTool ¶
SearchCodeTool returns the MCP tool definition for search_code.
func ValidateQueryTool ¶
ValidateQueryTool returns the MCP tool definition for validate_query.
Types ¶
type BSLHelpInput ¶
type BSLHelpInput struct {
Query string `` /* 155-byte string literal not displayed */
}
BSLHelpInput is the input schema for the bsl_syntax_help tool.
type MatchDisplay ¶
type MatchDisplay struct {
Prefix string // e.g. "[Расш] " for extension modules
DisplayName string // module name shown to the user
}
MatchDisplay holds the display name and optional prefix for a search match.
type MatchDisplayFunc ¶
type MatchDisplayFunc func(moduleName string) MatchDisplay
MatchDisplayFunc transforms a module name into a display name with an optional prefix. When nil is passed to FormatSearchResult, the module name is used as-is with no prefix (default community behavior).