Index
ipw.agents.mcp
¶
MCP (Model Context Protocol) server implementations.
This module provides unified interfaces for: - Local models (via Ollama, vLLM) - Cloud APIs (OpenAI, Anthropic, Gemini, OpenRouter) - Tools (calculator, web search, code interpreter) - Retrieval (BM25, dense, grep, hybrid)
All servers automatically capture telemetry (energy, power, cost, latency).
BaseMCPServer
¶
Bases: ABC
Base class for all MCP servers with automatic telemetry capture.
All subclasses must implement _execute_impl() which performs the actual tool invocation. The base class wraps this with telemetry collection.
Example
class MyTool(BaseMCPServer): def _execute_impl(self, prompt: str, **params) -> MCPToolResult: response = self.api.call(prompt) return MCPToolResult( content=response.text, usage={"prompt_tokens": 100, "completion_tokens": 50}, cost_usd=0.001 )
Source code in intelligence-per-watt/src/ipw/agents/mcp/base.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
__init__(name, telemetry_collector=None, event_recorder=None)
¶
Initialize MCP server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Tool name for logging/tracking |
required |
telemetry_collector
|
Optional[Any]
|
Energy monitor collector. If None, runs without telemetry. |
None
|
event_recorder
|
Optional[Any]
|
EventRecorder for per-action tracking. If None, no events recorded. |
None
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/base.py
execute(prompt, **params)
¶
Execute tool with automatic telemetry capture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
Input prompt/query for tool |
required |
**params
|
Any
|
Additional tool-specific parameters |
{}
|
Returns:
| Type | Description |
|---|---|
MCPToolResult
|
MCPToolResult with content, usage, cost, and telemetry samples |
Source code in intelligence-per-watt/src/ipw/agents/mcp/base.py
health_check()
¶
Check if tool is available and healthy.
Returns:
| Type | Description |
|---|---|
bool
|
True if tool is operational, False otherwise |
Source code in intelligence-per-watt/src/ipw/agents/mcp/base.py
MCPToolResult
dataclass
¶
Result from MCP tool execution with telemetry.
Source code in intelligence-per-watt/src/ipw/agents/mcp/base.py
content
instance-attribute
¶
Response text from tool/model
usage = field(default_factory=dict)
class-attribute
instance-attribute
¶
Token counts: prompt_tokens, completion_tokens, total_tokens
cost_usd = None
class-attribute
instance-attribute
¶
API cost in USD (for cloud APIs)
telemetry_samples = field(default_factory=list)
class-attribute
instance-attribute
¶
Energy/power/memory readings during execution
latency_seconds = 0.0
class-attribute
instance-attribute
¶
Wall-clock execution time
ttft_seconds = None
class-attribute
instance-attribute
¶
Time to first token (for streaming APIs)
metadata = field(default_factory=dict)
class-attribute
instance-attribute
¶
Additional tool-specific metadata
OpenAIMCPServer
¶
Bases: BaseMCPServer
MCP server for OpenAI models with automatic cost tracking.
Tracks API costs based on token usage and current pricing.
Example
server = OpenAIMCPServer( model_name="gpt-4o", api_key=os.getenv("OPENAI_API_KEY") )
result = server.execute("Explain quantum computing") print(result.content) print(f"Cost: ${result.cost_usd:.4f}")
Source code in intelligence-per-watt/src/ipw/agents/mcp/openai_server.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
__init__(model_name, api_key=None, telemetry_collector=None, event_recorder=None, **openai_params)
¶
Initialize OpenAI MCP server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
OpenAI model name (e.g., "gpt-4o", "gpt-5-mini-2025-08-07") |
required |
api_key
|
Optional[str]
|
OpenAI API key (or set OPENAI_API_KEY env var) |
None
|
telemetry_collector
|
Optional[Any]
|
Energy monitor collector |
None
|
event_recorder
|
Optional[Any]
|
EventRecorder for per-action tracking |
None
|
**openai_params
|
Any
|
Additional OpenAI parameters (temperature, max_tokens, etc.) |
{}
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/openai_server.py
health_check()
¶
Check if OpenAI API is accessible.
Source code in intelligence-per-watt/src/ipw/agents/mcp/openai_server.py
list_available_models()
¶
List all available OpenAI models.
Source code in intelligence-per-watt/src/ipw/agents/mcp/openai_server.py
AnthropicMCPServer
¶
Bases: BaseMCPServer
MCP server for Anthropic Claude models with cost tracking.
Example
server = AnthropicMCPServer( model_name="claude-sonnet-4-5-20250929", api_key=os.getenv("ANTHROPIC_API_KEY") )
result = server.execute("Write a haiku about AI") print(result.content) print(f"Cost: ${result.cost_usd:.4f}")
Source code in intelligence-per-watt/src/ipw/agents/mcp/anthropic_server.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
__init__(model_name, api_key=None, telemetry_collector=None, **anthropic_params)
¶
Initialize Anthropic MCP server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Claude model name |
required |
api_key
|
Optional[str]
|
Anthropic API key (or set ANTHROPIC_API_KEY env var) |
None
|
telemetry_collector
|
Optional[Any]
|
Energy monitor collector |
None
|
**anthropic_params
|
Any
|
Additional params (temperature, max_tokens, etc.) |
{}
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/anthropic_server.py
health_check()
¶
Check if Anthropic API is accessible.
Source code in intelligence-per-watt/src/ipw/agents/mcp/anthropic_server.py
OpenRouterMCPServer
¶
Bases: BaseMCPServer
MCP server for OpenRouter with automatic cost tracking.
OpenRouter provides a unified API for accessing many LLM providers. Uses OpenAI-compatible API format.
Example
server = OpenRouterMCPServer( model_name="google/gemini-2.5-flash", api_key=os.getenv("OPENROUTER_API_KEY") )
result = server.execute("Explain quantum computing") print(result.content) print(f"Cost: ${result.cost_usd:.6f}")
Source code in intelligence-per-watt/src/ipw/agents/mcp/openrouter_server.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
__init__(model_name, api_key=None, telemetry_collector=None, site_url=None, app_name=None, **openai_params)
¶
Initialize OpenRouter MCP server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Model identifier (e.g., "google/gemini-2.5-flash") |
required |
api_key
|
Optional[str]
|
OpenRouter API key (or set OPENROUTER_API_KEY env var) |
None
|
telemetry_collector
|
Optional[Any]
|
Energy monitor collector |
None
|
site_url
|
Optional[str]
|
Your site URL for OpenRouter rankings |
None
|
app_name
|
Optional[str]
|
Your app name for OpenRouter rankings |
None
|
**openai_params
|
Any
|
Additional parameters (temperature, max_tokens, etc.) |
{}
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/openrouter_server.py
health_check()
¶
Check if OpenRouter API is accessible.
Source code in intelligence-per-watt/src/ipw/agents/mcp/openrouter_server.py
list_popular_models()
classmethod
¶
VLLMMCPServer
¶
Bases: BaseMCPServer
MCP server for vLLM-served models.
vLLM provides an OpenAI-compatible API for serving large open-source models with optimizations like PagedAttention, continuous batching, and tensor parallelism.
Supported model categories: - General: Qwen3-32B, Qwen3-8B, Llama-3.3-70B-Instruct - Math specialist: Qwen2.5-Math-72B, Qwen2.5-Math-7B - Code specialist: Qwen2.5-Coder-32B, DeepSeek-Coder-V2
Example
Start vLLM server externally:¶
vllm serve Qwen/Qwen3-32B --tensor-parallel-size 4 --port 8000¶
server = VLLMMCPServer(model_name="qwen3-32b") result = server.execute("Explain quantum computing")
Source code in intelligence-per-watt/src/ipw/agents/mcp/vllm_server.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
__init__(model_name, vllm_url='http://localhost:8000', api_key=None, telemetry_collector=None, event_recorder=None, **vllm_params)
¶
Initialize vLLM server connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Model alias (e.g., 'qwen3-32b') or full HF path |
required |
vllm_url
|
str
|
URL of the vLLM server (default: localhost:8000) |
'http://localhost:8000'
|
api_key
|
Optional[str]
|
Optional API key for authenticated endpoints |
None
|
telemetry_collector
|
Optional[Any]
|
Energy monitor collector |
None
|
event_recorder
|
Optional[Any]
|
EventRecorder for per-action tracking |
None
|
**vllm_params
|
Any
|
Default parameters (max_tokens, temperature, top_p, etc.) |
{}
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/vllm_server.py
health_check()
¶
Check if vLLM server is running and model is loaded.
Source code in intelligence-per-watt/src/ipw/agents/mcp/vllm_server.py
list_supported_models()
classmethod
¶
CalculatorServer
¶
Bases: BaseMCPServer
MCP server for mathematical calculations.
Safely evaluates mathematical expressions using AST.
Example
calc = CalculatorServer() result = calc.execute("2 + 2 * 3") print(result.content) # "8"
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
WebSearchServer
¶
Bases: BaseMCPServer
MCP server for web search via Tavily API.
Tavily provides high-quality, AI-optimized search results designed for LLM consumption with structured, relevant content.
Example
search = WebSearchServer(api_key="tvly-xxx") result = search.execute("latest AI news")
Cost: ~$0.01 per search (Tavily free tier: 1000 searches/month)
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
CodeInterpreterServer
¶
Bases: BaseMCPServer
MCP server for Python code execution with optional sandbox isolation.
Executes Python code in a subprocess with timeout protection. Supports bubblewrap (bwrap) for filesystem isolation on Linux.
Isolation modes
- None: Direct subprocess execution (default, for compatibility)
- "bubblewrap": Linux namespace isolation with read-only root fs
- "auto": Use bubblewrap if available, fall back to direct execution
Example
interpreter = CodeInterpreterServer(isolation="auto") result = interpreter.execute("print([x**2 for x in range(10)])")
Cost: ~$0.0000083 per second of compute (based on cloud GPU rates)
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | |
__init__(timeout=30, max_output_length=10000, telemetry_collector=None, isolation=None, allowed_paths=None)
¶
Initialize code interpreter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
int
|
Maximum execution time in seconds (default: 30) |
30
|
max_output_length
|
int
|
Maximum characters to return (default: 10000) |
10000
|
telemetry_collector
|
Optional[Any]
|
Energy monitor collector |
None
|
isolation
|
Optional[str]
|
Isolation mode - None, "bubblewrap", or "auto" |
None
|
allowed_paths
|
Optional[List[str]]
|
Additional paths to mount read-only in sandbox |
None
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
ThinkServer
¶
Bases: BaseMCPServer
MCP server for internal reasoning/scratchpad.
This is a "thinking" tool that allows the model to break down complex problems step-by-step before delegating to other tools. It simply returns the input thought process without any processing.
Example
think = ThinkServer() result = think.execute("Let me break this down: 1) First... 2) Then...")
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
FileReadServer
¶
Bases: BaseMCPServer
MCP server for reading file contents.
Security: Only allows reading files within allowed directories.
Example
reader = FileReadServer(allowed_dirs=["/workspace"]) result = reader.execute("/workspace/file.txt")
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 | |
FileWriteServer
¶
Bases: BaseMCPServer
MCP server for writing file contents.
Security: Only allows writing files within allowed directories. Creates parent directories if they don't exist.
Example
writer = FileWriteServer(allowed_dirs=["/workspace"]) result = writer.execute("/workspace/output.txt", content="Hello, World!")
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_server.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
ToolRegistry
¶
Unified registry for all ToolOrchestra + ADP tools.
Example
registry = ToolRegistry() registry.discover_tools()
tools = registry.get_available_tools() small_llms = registry.get_tools_by_category(ToolCategory.LLM_SMALL)
calc = registry.get_tool_instance("calculator") result = calc.execute("2 + 2")
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
__init__(ollama_base_url='http://localhost:11434', vllm_base_url='http://localhost:8000', telemetry_collector=None, code_isolation='auto', retrieval_gpu_device=None)
¶
Initialize tool registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ollama_base_url
|
str
|
Base URL for Ollama server |
'http://localhost:11434'
|
vllm_base_url
|
str
|
Base URL for vLLM server |
'http://localhost:8000'
|
telemetry_collector
|
Optional[Any]
|
Energy monitor collector for all tools |
None
|
code_isolation
|
Optional[str]
|
Isolation mode for code_interpreter tool. |
'auto'
|
retrieval_gpu_device
|
Optional[int]
|
GPU device index for neural retrieval models. |
None
|
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
register(spec)
¶
get_spec(name)
¶
get_all_specs()
¶
get_specs_by_category(category)
¶
Get tool specifications by category.
get_specs_for_domain(domain)
¶
Get tool specifications relevant for an ADP domain.
get_specs_by_capability(capability)
¶
Get tool specifications by capability tag.
discover_available_tools()
¶
Discover which tools are actually available.
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
get_tool_instance(name)
¶
Get or create a tool instance.
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
get_tool_descriptions(tools=None)
¶
Get formatted tool descriptions for prompting.
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
ToolSpec
dataclass
¶
Specification for a tool in the registry.
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
name
instance-attribute
¶
Unique tool identifier (e.g., 'calculator', 'ollama:qwen2.5:1.5b')
category
instance-attribute
¶
Tool category for routing decisions
description
instance-attribute
¶
Human-readable description for policy model
server_class = None
class-attribute
instance-attribute
¶
MCP server class to instantiate
factory = None
class-attribute
instance-attribute
¶
Factory function for custom initialization
estimated_latency_ms = 0.0
class-attribute
instance-attribute
¶
Estimated latency in milliseconds
estimated_cost_usd = 0.0
class-attribute
instance-attribute
¶
Estimated cost per call in USD
estimated_energy_joules = 0.0
class-attribute
instance-attribute
¶
Estimated energy consumption per call
requires_api_key = None
class-attribute
instance-attribute
¶
Environment variable name for required API key
requires_server = None
class-attribute
instance-attribute
¶
Required server (e.g., 'ollama', 'vllm')
adp_domains = field(default_factory=list)
class-attribute
instance-attribute
¶
ADP domains this tool is relevant for
capabilities = field(default_factory=list)
class-attribute
instance-attribute
¶
Capability tags (e.g., 'math', 'code', 'reasoning')
ToolCategory
¶
Bases: Enum
Categories of tools matching ToolOrchestra + ADP domains.
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
ADPDomainServer
¶
Bases: BaseMCPServer
Passthrough server for ADP domain-specific actions.
Source code in intelligence-per-watt/src/ipw/agents/mcp/tool_registry.py
get_registry(**kwargs)
¶
Get or create the global tool registry.