Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .cursor/rules/no-relative-imports.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ actions:
1. Always use absolute imports:
```python
# Good
from stackone_ai.tools import ToolDefinition
from stackone_ai.constants import OAS_DIR
from stackone_ai.models import ToolDefinition
from stackone_ai.constants import DEFAULT_HYBRID_ALPHA

# Bad
from .tools import ToolDefinition
from ..constants import OAS_DIR
from .models import ToolDefinition
from ..constants import DEFAULT_HYBRID_ALPHA
```

2. Guidelines:
Expand All @@ -40,12 +40,12 @@ actions:
examples:
- input: |
# Bad: Using relative imports
from .tools import ToolDefinition
from ..constants import OAS_DIR
from .models import ToolDefinition
from ..constants import DEFAULT_HYBRID_ALPHA

# Good: Using absolute imports
from stackone_ai.tools import ToolDefinition
from stackone_ai.constants import OAS_DIR
from stackone_ai.models import ToolDefinition
from stackone_ai.constants import DEFAULT_HYBRID_ALPHA
output: "Correctly formatted absolute imports"

metadata:
Expand Down
35 changes: 11 additions & 24 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,29 @@ make mcp-inspector # Run MCP server inspector for debugging

1. **StackOneToolSet** (`stackone_ai/toolset.py`): Main entry point
- Handles authentication (API key + optional account ID)
- Manages tool loading with glob pattern filtering
- Fetches tools dynamically via MCP endpoint
- Provides format converters for OpenAI/LangChain

2. **Models** (`stackone_ai/models.py`): Data structures
- `StackOneTool`: Base class with execution logic
- `Tools`: Container for managing multiple tools
- Format converters for different AI frameworks

3. **OpenAPI Parser** (`stackone_ai/specs/parser.py`): Spec conversion
- Converts OpenAPI specs to tool definitions
- Handles file upload detection (`format: binary` → `type: file`)
- Resolves schema references

4. **MCP Server** (`stackone_ai/server.py`): Protocol implementation
3. **MCP Server** (`stackone_ai/server.py`): Protocol implementation
- Async tool execution
- CLI interface via `stackmcp` command

### OpenAPI Specifications

All tool definitions are generated from OpenAPI specs in `stackone_ai/oas/`:
- `core.json`, `ats.json`, `crm.json`, `documents.json`, `hris.json`, `iam.json`, `lms.json`, `marketing.json`

## Key Development Patterns

### Tool Filtering
### Tool Fetching
```python
# Use glob patterns for tool selection
tools = StackOneToolSet(include_tools=["hris_*", "!hris_create_*"])
# Fetch tools dynamically from MCP endpoint
toolset = StackOneToolSet(api_key="your-api-key")
tools = toolset.fetch_tools(
account_ids=["account-1"],
providers=["hibob"],
actions=["*_list_*"]
)
```

### Authentication
Expand All @@ -89,7 +84,6 @@ toolset = StackOneToolSet(
- Use generics for better IDE support

### Testing
- Snapshot testing for tool parsing (`tests/snapshots/`)
- Async tests use `pytest-asyncio`
- Example validation: See @./.cursor/rules/examples-standards

Expand All @@ -99,20 +93,13 @@ toolset = StackOneToolSet(
2. **Pre-commit**: Hooks configured for ruff and mypy - run on all commits
3. **Python Version**: Requires Python >=3.11
4. **Error Handling**: Custom exceptions (`StackOneError`, `StackOneAPIError`)
5. **File Uploads**: Binary parameters auto-detected from OpenAPI specs
6. **Context Window**: Tool loading warns when loading all tools (large context)

## Common Tasks

### Adding New SaaS Integration
1. Add OpenAPI spec to `stackone_ai/oas/`
2. Parser automatically converts to tool definitions
3. Test with `make test-tools`

### Modifying Tool Behavior
- Core execution logic in `StackOneTool.execute()` method
- HTTP configuration via `ExecuteConfig` class
- Response handling in `_process_response()`
- RPC tool execution via `_StackOneRpcTool` class

### Updating Documentation
- Examples requirements: See @./.cursor/rules/examples-standards
Expand Down
89 changes: 0 additions & 89 deletions scripts/pull_oas.py

This file was deleted.

6 changes: 0 additions & 6 deletions stackone_ai/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import importlib.resources
from pathlib import Path

# Use bundled specs directly
OAS_DIR = Path(str(importlib.resources.files("stackone_ai") / "oas"))

# Hybrid search default weight for BM25 vs TF-IDF
# alpha=0.2 means: 20% BM25 + 80% TF-IDF
# This value was optimized through validation testing and provides
Expand Down
Loading