chunk_details
Retrieve full content of a specific code chunk by its ID, enabling focused examination after identifying relevant code sections through intelligent search tools.
Instructions
Get full content of a specific chunk.
Returns chunk content as string.
Common patterns:
1. Final step after find_matching_chunks_in_file finds relevant chunks
2. Examining implementations after finding definitions/uses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chunk_id | Yes |
Implementation Reference
- mcpunk/tools.py:388-416 (handler)The handler function for the 'chunk_details' tool. It takes a chunk_id, searches through all loaded projects and files for the matching chunk, and returns its content using MCPToolOutput. Decorators @mcp.tool() registers it and @log_inputs_outputs() logs inputs/outputs.@mcp.tool() @log_inputs_outputs() def chunk_details( chunk_id: str, ) -> ToolResponse: """Get full content of a specific chunk. Returns chunk content as string. Common patterns: 1. Final step after find_matching_chunks_in_file finds relevant chunks 2. Examining implementations after finding definitions/uses """ # Yeah this is an awful brute force "search" - if it is even deserving of the # name "search"! Ah well. the_chunk: Chunk | None = None for project in PROJECTS.values(): for file in project.chunk_project.files: for chunk in file.chunks: if chunk.id_(file.abs_path) == chunk_id: the_chunk = chunk break if the_chunk is None: return MCPToolOutput( text="No matching chunks. Please use other tools to find available chunks.", ).render() return MCPToolOutput(text=inspect.cleandoc(the_chunk.content)).render()
- mcpunk/tools.py:388-388 (registration)The @mcp.tool() decorator registers the chunk_details function as an MCP tool.@mcp.tool()