Skip to content

Commit d186c2d

Browse files
committed
feat: add applications as providers
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
1 parent ef3ed4f commit d186c2d

4 files changed

Lines changed: 9 additions & 13 deletions

File tree

mcpserver/core/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import time
44

5+
from resource_secretary.apps import discover_applications
56
from resource_secretary.providers import discover_providers
67
from resource_secretary.providers.mock import discover_mock_providers
78

@@ -15,19 +16,20 @@ class WorkerBase:
1516
ask secretary. We provide it here so that a hub can use it to generate
1617
its dual mode (acting as worker AND hub.)
1718
"""
19+
1820
def jsonify_response(self, result):
1921
"""
2022
Ensure we get the text, and separate and parse tool calls,
2123
which the agent will return in a verbose mode.
2224
"""
23-
print('result')
25+
print("result")
2426
print(result)
2527
print(type(result))
2628
if isinstance(result, dict):
2729
return result
2830
if not isinstance(result, str) and hasattr(result, "content"):
2931
result = result.content[0].text
30-
32+
3133
# Audit the tool calls (Did the agent just get lucky?)
3234
calls = []
3335
if "CALLS" in result:
@@ -47,11 +49,14 @@ def init_providers(self, mock=False):
4749
Probe the local system on startup. E.g., "we found spack, flux, etc."
4850
These can be faux (mock) or real discovered providers
4951
"""
52+
# We can use apps in mock or regular
53+
apps = discover_applications()
5054
logger.info("📡 Probing local system for resource providers...")
5155
if mock:
5256
self.catalog = discover_mock_providers(self.worker_id, choice=mock)
5357
else:
5458
self.catalog = discover_providers()
59+
self.catalog.update(apps)
5560

5661
def register_agent_tools(self):
5762
"""

mcpserver/core/hub.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,6 @@ async def dispatch_job(worker_id: str, prompt: str) -> dict:
209209

210210
async with info["client"] as sess:
211211
result = await sess.call_tool("submit", {"request": prompt})
212-
print('response in hub')
213-
print(type(result))
214-
print(result)
215212
return self.jsonify_response(result)
216213

217214
@self.mcp.tool(name="negotiate_job")

mcpserver/core/worker.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from typing import Any, Dict, Optional
44

55
import httpx
6-
from resource_secretary.providers import discover_providers
7-
from resource_secretary.providers.mock import discover_mock_providers
86
from rich import print
97

108
from mcpserver.logger import logger

mcpserver/utils/text.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import re
32

43

@@ -21,14 +20,11 @@ def format_calls(calls_block):
2120
"""
2221
calls = []
2322
try:
24-
print(calls_block)
25-
print(type(calls_block))
2623
calls = extract_code_block(calls_block)
27-
print('success to extract calls')
2824
return calls
2925
except Exception as e:
30-
print(f'Issue in format calls: {e}')
31-
return calls
26+
print(f"Issue in format calls: {e}")
27+
return calls_block
3228

3329

3430
def extract_code_block(text):

0 commit comments

Comments
 (0)