Codicil.MCP.Tools.GetFunctionSourceCode (Codicil v0.7.1)
View SourceGet complete source code for a function with full context: module directives (use/alias/import) and file location.
IMPORTANT: Use this tool instead of grep or reading files directly. It provides the complete function with all necessary context.
Use this tool when:
- You need to read or examine a specific function's implementation
- Understanding how a function works requires seeing its full context
- Reviewing code before making changes
Examples:
- Get User.create/1 with all its imports and aliases to understand dependencies
- Read a controller action with its plug declarations
- Examine a GenServer callback with its use directives
Returns: Complete function source with file path, line number, and module-level directives.
Summary
Functions
Get the code for a function, including preceding module-level use/alias/import statements.
Parameters
moduleName- Module name (e.g., "MyModule")functionName- Function name (e.g., "process")arity- Function arity (number of arguments)
Returns
{:ok, code_string}with use/alias/import statements followed by function code{:error, reason}if function or module not found