Handle tool calls.
(name: str, arguments: dict[str, Any])
| 542 | |
| 543 | @server.call_tool() |
| 544 | async def call_tool(name: str, arguments: dict[str, Any]) -> Any: |
| 545 | """Handle tool calls.""" |
| 546 | |
| 547 | project_root = Path(__file__).parent |
| 548 | |
| 549 | try: |
| 550 | if name == "run_tests": |
| 551 | return await run_tests(arguments, project_root) |
| 552 | elif name == "list_test_cases": |
| 553 | return await list_test_cases(arguments, project_root) |
| 554 | elif name == "compile_examples": |
| 555 | return await compile_examples(arguments, project_root) |
| 556 | elif name == "code_fingerprint": |
| 557 | return await code_fingerprint(arguments, project_root) |
| 558 | elif name == "lint_code": |
| 559 | return await lint_code(arguments, project_root) |
| 560 | elif name == "list_examples": |
| 561 | return await list_examples(arguments, project_root) |
| 562 | elif name == "project_info": |
| 563 | return await project_info(arguments, project_root) |
| 564 | elif name == "run_specific_command": |
| 565 | return await run_specific_command(arguments, project_root) |
| 566 | elif name == "test_instructions": |
| 567 | return await test_instructions(arguments, project_root) |
| 568 | elif name == "setup_stack_traces": |
| 569 | return await setup_stack_traces(arguments, project_root) |
| 570 | elif name == "coding_standards": |
| 571 | return await coding_standards(arguments, project_root) |
| 572 | elif name == "validate_completion": |
| 573 | return await validate_completion(arguments, project_root) |
| 574 | elif name == "build_info_analysis": |
| 575 | return await build_info_analysis(arguments, project_root) |
| 576 | elif name == "esp32_symbol_analysis": |
| 577 | return await esp32_symbol_analysis(arguments, project_root) |
| 578 | elif name == "symbol_analysis": |
| 579 | return await symbol_analysis(arguments, project_root) |
| 580 | elif name == "run_fastled_web_compiler": |
| 581 | return await run_fastled_web_compiler(arguments, project_root) |
| 582 | elif name == "validate_arduino_includes": |
| 583 | return await validate_arduino_includes(arguments, project_root) |
| 584 | elif name == "git_historian": |
| 585 | return await git_historian(arguments, project_root) |
| 586 | else: |
| 587 | return CallToolResult( |
| 588 | content=[TextContent(type="text", text=f"Unknown tool: {name}")], |
| 589 | isError=True, |
| 590 | ) |
| 591 | except Exception as e: |
| 592 | return CallToolResult( |
| 593 | content=[ |
| 594 | TextContent(type="text", text=f"Error executing {name}: {str(e)}") |
| 595 | ], |
| 596 | isError=True, |
| 597 | ) |
| 598 | |
| 599 | |
| 600 | async def run_tests(arguments: dict[str, Any], project_root: Path) -> CallToolResult: |
nothing calls this directly
no test coverage detected