- Extract core MCP logic into a new `mcpcore` module - Remove logging that interferes with JSON-RPC over STDIO - Improve server loop to parse requests before handling - Add stub for `logging/setLevel` JSON-RPC method - Refactor vcode server into a dedicated logic submodule
73 lines
2.4 KiB
Verilog
73 lines
2.4 KiB
Verilog
module vcode
|
|
|
|
// import freeflowuniverse.herolib.ai.mcpcore
|
|
// TODO: Uncomment when mcpcore module is fixed
|
|
/*
|
|
// import freeflowuniverse.herolib.develop.codetools as code
|
|
import freeflowuniverse.herolib.schemas.jsonschema
|
|
import x.json2 { Any }
|
|
|
|
const write_vfile_tool = mcpcore.Tool{
|
|
name: 'write_vfile'
|
|
description: 'write_vfile parses a V code string into a VFile and writes it to the specified path
|
|
ARGS:
|
|
path string - directory path where to write the file
|
|
code string - V code content to write
|
|
format bool - whether to format the code (optional, default: false)
|
|
overwrite bool - whether to overwrite existing file (optional, default: false)
|
|
prefix string - prefix to add to the filename (optional, default: "")
|
|
RETURNS: string - success message with the path of the written file'
|
|
input_schema: jsonschema.Schema{
|
|
typ: 'object'
|
|
properties: {
|
|
'path': jsonschema.SchemaRef(jsonschema.Schema{
|
|
typ: 'string'
|
|
})
|
|
'code': jsonschema.SchemaRef(jsonschema.Schema{
|
|
typ: 'string'
|
|
})
|
|
'format': jsonschema.SchemaRef(jsonschema.Schema{
|
|
typ: 'boolean'
|
|
})
|
|
'overwrite': jsonschema.SchemaRef(jsonschema.Schema{
|
|
typ: 'boolean'
|
|
})
|
|
'prefix': jsonschema.SchemaRef(jsonschema.Schema{
|
|
typ: 'string'
|
|
})
|
|
}
|
|
required: ['path', 'code']
|
|
}
|
|
}
|
|
*/
|
|
|
|
// TODO: Uncomment when mcpcore module is fixed
|
|
/*
|
|
pub fn (d &VCode) write_vfile_tool_handler(arguments map[string]Any) !mcpcore.ToolCallResult {
|
|
path := arguments['path'] or {
|
|
return mcpcore.error_tool_call_result(error('Missing path argument'))
|
|
}.str()
|
|
code_str := arguments['code'] or {
|
|
return mcpcore.error_tool_call_result(error('Missing code argument'))
|
|
}.str()
|
|
|
|
// Parse optional parameters with defaults
|
|
format := if 'format' in arguments { arguments['format'] or { false }.bool() } else { false }
|
|
overwrite := if 'overwrite' in arguments {
|
|
arguments['overwrite'] or { false }.bool()
|
|
} else {
|
|
false
|
|
}
|
|
prefix := if 'prefix' in arguments { arguments['prefix'] or { '' }.str() } else { '' }
|
|
|
|
// TODO: Implement actual V file parsing and writing
|
|
// For now, return a placeholder message
|
|
result := 'Writing V file to ${path} with code length ${code_str.len} (format: ${format}, overwrite: ${overwrite}, prefix: "${prefix}") is not yet implemented'
|
|
|
|
return mcpcore.ToolCallResult{
|
|
is_error: false
|
|
content: mcpcore.result_to_mcp_tool_contents[string](result)
|
|
}
|
|
}
|
|
*/
|